@techzyapp/ui-library 1.0.48 → 1.0.50

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 (480) hide show
  1. package/dist/{Accordion-DOrTQJB9.js → Accordion-C6vW_OMd.js} +2 -2
  2. package/dist/{Accordion-DOrTQJB9.js.map → Accordion-C6vW_OMd.js.map} +1 -1
  3. package/dist/{Accordion-CFyeLfPT.cjs → Accordion-Icvl9S8c.cjs} +2 -2
  4. package/dist/{Accordion-CFyeLfPT.cjs.map → Accordion-Icvl9S8c.cjs.map} +1 -1
  5. package/dist/{AdminRoot-DX6glneh.js → AdminRoot-C5l8PIyi.js} +9 -9
  6. package/dist/{AdminRoot-DX6glneh.js.map → AdminRoot-C5l8PIyi.js.map} +1 -1
  7. package/dist/{AdminRoot-DAz9u2Yc.cjs → AdminRoot-MEfy9xtz.cjs} +2 -2
  8. package/dist/{AdminRoot-DAz9u2Yc.cjs.map → AdminRoot-MEfy9xtz.cjs.map} +1 -1
  9. package/dist/{Alert-QvfNBhlU.cjs → Alert--ZnlCjaL.cjs} +2 -2
  10. package/dist/{Alert-QvfNBhlU.cjs.map → Alert--ZnlCjaL.cjs.map} +1 -1
  11. package/dist/{Alert-Bo_XgY-A.js → Alert-BVs-GcZQ.js} +4 -4
  12. package/dist/{Alert-Bo_XgY-A.js.map → Alert-BVs-GcZQ.js.map} +1 -1
  13. package/dist/AuthGuard-Cm-tqCto.cjs +2 -0
  14. package/dist/AuthGuard-Cm-tqCto.cjs.map +1 -0
  15. package/dist/AuthGuard-DJ_mMwfg.js +114 -0
  16. package/dist/AuthGuard-DJ_mMwfg.js.map +1 -0
  17. package/dist/{AuthLayout-BI1wLuDl.js → AuthLayout-BDRJFSpi.js} +2 -2
  18. package/dist/{AuthLayout-BI1wLuDl.js.map → AuthLayout-BDRJFSpi.js.map} +1 -1
  19. package/dist/{AuthLayout-Bzlsvicf.cjs → AuthLayout-D7mSMdM4.cjs} +2 -2
  20. package/dist/{AuthLayout-Bzlsvicf.cjs.map → AuthLayout-D7mSMdM4.cjs.map} +1 -1
  21. package/dist/{Avatar-BBqX1732.cjs → Avatar-BwGJl-ru.cjs} +2 -2
  22. package/dist/{Avatar-BBqX1732.cjs.map → Avatar-BwGJl-ru.cjs.map} +1 -1
  23. package/dist/{Avatar-CaYyv5wk.js → Avatar-C4qgzth2.js} +2 -2
  24. package/dist/{Avatar-CaYyv5wk.js.map → Avatar-C4qgzth2.js.map} +1 -1
  25. package/dist/{AvatarGroup-DrkzAt1-.cjs → AvatarGroup-B8u8ONs5.cjs} +2 -2
  26. package/dist/{AvatarGroup-DrkzAt1-.cjs.map → AvatarGroup-B8u8ONs5.cjs.map} +1 -1
  27. package/dist/{AvatarGroup-6fhm-van.js → AvatarGroup-BqxTFzRc.js} +2 -2
  28. package/dist/{AvatarGroup-6fhm-van.js.map → AvatarGroup-BqxTFzRc.js.map} +1 -1
  29. package/dist/{Breadcrumbs-CqGS32x5.cjs → Breadcrumbs-D4wv2-T7.cjs} +2 -2
  30. package/dist/{Breadcrumbs-CqGS32x5.cjs.map → Breadcrumbs-D4wv2-T7.cjs.map} +1 -1
  31. package/dist/{Breadcrumbs-BEv57tuJ.js → Breadcrumbs-HGk4DKrc.js} +4 -4
  32. package/dist/{Breadcrumbs-BEv57tuJ.js.map → Breadcrumbs-HGk4DKrc.js.map} +1 -1
  33. package/dist/{Button-DZWYeAno.js → Button-7mgXcRdw.js} +2 -2
  34. package/dist/{Button-DZWYeAno.js.map → Button-7mgXcRdw.js.map} +1 -1
  35. package/dist/{Button-BtiFpRie.cjs → Button-DAvQCGIw.cjs} +2 -2
  36. package/dist/{Button-BtiFpRie.cjs.map → Button-DAvQCGIw.cjs.map} +1 -1
  37. package/dist/{Calendar-7W9xNVBZ.js → Calendar-B1ZJHqjB.js} +4 -4
  38. package/dist/{Calendar-7W9xNVBZ.js.map → Calendar-B1ZJHqjB.js.map} +1 -1
  39. package/dist/{Calendar-Bgh_3Vk2.cjs → Calendar-BPYjqBy9.cjs} +2 -2
  40. package/dist/{Calendar-Bgh_3Vk2.cjs.map → Calendar-BPYjqBy9.cjs.map} +1 -1
  41. package/dist/{Card-KfmWG9Uz.cjs → Card-B-Qso__1.cjs} +2 -2
  42. package/dist/{Card-KfmWG9Uz.cjs.map → Card-B-Qso__1.cjs.map} +1 -1
  43. package/dist/{Card-ckOd617g.js → Card-vFsIhkyR.js} +4 -4
  44. package/dist/{Card-ckOd617g.js.map → Card-vFsIhkyR.js.map} +1 -1
  45. package/dist/{Chip-Crzm7Eux.js → Chip-CU0J7HJa.js} +3 -3
  46. package/dist/{Chip-Crzm7Eux.js.map → Chip-CU0J7HJa.js.map} +1 -1
  47. package/dist/{Chip-BDUsue_R.cjs → Chip-CovsonP1.cjs} +2 -2
  48. package/dist/{Chip-BDUsue_R.cjs.map → Chip-CovsonP1.cjs.map} +1 -1
  49. package/dist/{ChoiceCardGroup-D37XREKV.js → ChoiceCardGroup-BBqUbFLS.js} +2 -2
  50. package/dist/{ChoiceCardGroup-D37XREKV.js.map → ChoiceCardGroup-BBqUbFLS.js.map} +1 -1
  51. package/dist/{ChoiceCardGroup-Cj_YFj6C.cjs → ChoiceCardGroup-bnKFPDYz.cjs} +2 -2
  52. package/dist/{ChoiceCardGroup-Cj_YFj6C.cjs.map → ChoiceCardGroup-bnKFPDYz.cjs.map} +1 -1
  53. package/dist/{CodeBlock-rnGAu2DQ.cjs → CodeBlock-B404V_cc.cjs} +2 -2
  54. package/dist/{CodeBlock-rnGAu2DQ.cjs.map → CodeBlock-B404V_cc.cjs.map} +1 -1
  55. package/dist/{CodeBlock-CX8_dMPD.js → CodeBlock-DvJ45qEp.js} +4 -4
  56. package/dist/{CodeBlock-CX8_dMPD.js.map → CodeBlock-DvJ45qEp.js.map} +1 -1
  57. package/dist/{ColorPicker-CwLivdAt.js → ColorPicker-C4slmEZC.js} +3 -3
  58. package/dist/{ColorPicker-CwLivdAt.js.map → ColorPicker-C4slmEZC.js.map} +1 -1
  59. package/dist/{ColorPicker-BaAdcqR9.cjs → ColorPicker-_RBW51XB.cjs} +2 -2
  60. package/dist/{ColorPicker-BaAdcqR9.cjs.map → ColorPicker-_RBW51XB.cjs.map} +1 -1
  61. package/dist/{ColorPickerPanel-IOhJJF1R.cjs → ColorPickerPanel-CNspBZre.cjs} +2 -2
  62. package/dist/{ColorPickerPanel-IOhJJF1R.cjs.map → ColorPickerPanel-CNspBZre.cjs.map} +1 -1
  63. package/dist/{ColorPickerPanel-CkrSIf35.js → ColorPickerPanel-CQNfIbgc.js} +3 -3
  64. package/dist/{ColorPickerPanel-CkrSIf35.js.map → ColorPickerPanel-CQNfIbgc.js.map} +1 -1
  65. package/dist/{ColorRamp-DbFOsspz.js → ColorRamp-DQZZiE5I.js} +2 -2
  66. package/dist/{ColorRamp-DbFOsspz.js.map → ColorRamp-DQZZiE5I.js.map} +1 -1
  67. package/dist/{ColorRamp-BCy8a7ks.cjs → ColorRamp-DuO7gkru.cjs} +2 -2
  68. package/dist/{ColorRamp-BCy8a7ks.cjs.map → ColorRamp-DuO7gkru.cjs.map} +1 -1
  69. package/dist/{ConfigProvider-CYSpuSMJ.cjs → ConfigProvider-BFhkb0BV.cjs} +2 -2
  70. package/dist/{ConfigProvider-CYSpuSMJ.cjs.map → ConfigProvider-BFhkb0BV.cjs.map} +1 -1
  71. package/dist/{ConfigProvider-DtyUlWk6.js → ConfigProvider-bXX8dnhY.js} +2 -2
  72. package/dist/{ConfigProvider-DtyUlWk6.js.map → ConfigProvider-bXX8dnhY.js.map} +1 -1
  73. package/dist/{CopyButton-DUG5s3TM.cjs → CopyButton-B2V6guZ0.cjs} +2 -2
  74. package/dist/{CopyButton-DUG5s3TM.cjs.map → CopyButton-B2V6guZ0.cjs.map} +1 -1
  75. package/dist/{CopyButton-LURMuaYw.js → CopyButton-DfYAslz-.js} +4 -4
  76. package/dist/{CopyButton-LURMuaYw.js.map → CopyButton-DfYAslz-.js.map} +1 -1
  77. package/dist/{DashedButton-BX8hfY1x.cjs → DashedButton-CZ2hjLxT.cjs} +2 -2
  78. package/dist/{DashedButton-BX8hfY1x.cjs.map → DashedButton-CZ2hjLxT.cjs.map} +1 -1
  79. package/dist/{DashedButton-wcmXTYBw.js → DashedButton-meJSIY61.js} +2 -2
  80. package/dist/{DashedButton-wcmXTYBw.js.map → DashedButton-meJSIY61.js.map} +1 -1
  81. package/dist/{DatePicker-CSIBYSZt.js → DatePicker-CNUDjOxA.js} +5 -5
  82. package/dist/{DatePicker-CSIBYSZt.js.map → DatePicker-CNUDjOxA.js.map} +1 -1
  83. package/dist/{DatePicker-Bw9gLB8o.cjs → DatePicker-DrIHa1j1.cjs} +2 -2
  84. package/dist/{DatePicker-Bw9gLB8o.cjs.map → DatePicker-DrIHa1j1.cjs.map} +1 -1
  85. package/dist/{DateTimePicker-kikKdt0F.cjs → DateTimePicker-BzwxaOPb.cjs} +2 -2
  86. package/dist/{DateTimePicker-kikKdt0F.cjs.map → DateTimePicker-BzwxaOPb.cjs.map} +1 -1
  87. package/dist/{DateTimePicker-C9F2yJMf.js → DateTimePicker-CvWNDbib.js} +8 -8
  88. package/dist/{DateTimePicker-C9F2yJMf.js.map → DateTimePicker-CvWNDbib.js.map} +1 -1
  89. package/dist/{DescriptionList-DnGkHdzT.cjs → DescriptionList-Bed1MHU8.cjs} +2 -2
  90. package/dist/{DescriptionList-DnGkHdzT.cjs.map → DescriptionList-Bed1MHU8.cjs.map} +1 -1
  91. package/dist/{DescriptionList-kfNXbf_D.js → DescriptionList-BgMNjHJQ.js} +5 -5
  92. package/dist/{DescriptionList-kfNXbf_D.js.map → DescriptionList-BgMNjHJQ.js.map} +1 -1
  93. package/dist/{Dropdown-C_y9_dVn.cjs → Dropdown-DNL7RWdL.cjs} +2 -2
  94. package/dist/{Dropdown-C_y9_dVn.cjs.map → Dropdown-DNL7RWdL.cjs.map} +1 -1
  95. package/dist/{Dropdown-D-D_Z1Jo.js → Dropdown-iWbHokT7.js} +2 -2
  96. package/dist/{Dropdown-D-D_Z1Jo.js.map → Dropdown-iWbHokT7.js.map} +1 -1
  97. package/dist/{EmptyState-BM5LrRLq.cjs → EmptyState-BzwrOICc.cjs} +2 -2
  98. package/dist/{EmptyState-BM5LrRLq.cjs.map → EmptyState-BzwrOICc.cjs.map} +1 -1
  99. package/dist/{EmptyState-DrSj2XV_.js → EmptyState-CmcjJl_K.js} +3 -3
  100. package/dist/{EmptyState-DrSj2XV_.js.map → EmptyState-CmcjJl_K.js.map} +1 -1
  101. package/dist/{ErrorBoundary-yz669VEu.cjs → ErrorBoundary-BcZgeSsu.cjs} +2 -2
  102. package/dist/{ErrorBoundary-yz669VEu.cjs.map → ErrorBoundary-BcZgeSsu.cjs.map} +1 -1
  103. package/dist/{ErrorBoundary-DsP4hO_V.js → ErrorBoundary-TfeJetWc.js} +3 -3
  104. package/dist/{ErrorBoundary-DsP4hO_V.js.map → ErrorBoundary-TfeJetWc.js.map} +1 -1
  105. package/dist/{ErrorState-BThPIYaM.cjs → ErrorState-CzWz5UcX.cjs} +2 -2
  106. package/dist/{ErrorState-BThPIYaM.cjs.map → ErrorState-CzWz5UcX.cjs.map} +1 -1
  107. package/dist/{ErrorState-DEngucdq.js → ErrorState-EjIhdq7S.js} +8 -8
  108. package/dist/{ErrorState-DEngucdq.js.map → ErrorState-EjIhdq7S.js.map} +1 -1
  109. package/dist/{FileCard-CmCESTQd.js → FileCard-CmMxVyk3.js} +5 -5
  110. package/dist/{FileCard-CmCESTQd.js.map → FileCard-CmMxVyk3.js.map} +1 -1
  111. package/dist/{FileCard-wxDT2rj9.cjs → FileCard-Cxr1_eF2.cjs} +2 -2
  112. package/dist/{FileCard-wxDT2rj9.cjs.map → FileCard-Cxr1_eF2.cjs.map} +1 -1
  113. package/dist/{FileUploader-Dp1r4Sxc.js → FileUploader-2cXBI4Nh.js} +7 -7
  114. package/dist/{FileUploader-Dp1r4Sxc.js.map → FileUploader-2cXBI4Nh.js.map} +1 -1
  115. package/dist/{FileUploader-DBNRp5eT.cjs → FileUploader-BkM1t2aE.cjs} +2 -2
  116. package/dist/{FileUploader-DBNRp5eT.cjs.map → FileUploader-BkM1t2aE.cjs.map} +1 -1
  117. package/dist/{Flag-B6OhgwZr.cjs → Flag-CWp81_zX.cjs} +2 -2
  118. package/dist/{Flag-B6OhgwZr.cjs.map → Flag-CWp81_zX.cjs.map} +1 -1
  119. package/dist/{Flag-Q3vI7cgt.js → Flag-IQolG3j6.js} +2 -2
  120. package/dist/{Flag-Q3vI7cgt.js.map → Flag-IQolG3j6.js.map} +1 -1
  121. package/dist/{FullscreenToggle-WGsbE3Op.js → FullscreenToggle-B1DH_-k3.js} +4 -4
  122. package/dist/{FullscreenToggle-WGsbE3Op.js.map → FullscreenToggle-B1DH_-k3.js.map} +1 -1
  123. package/dist/{FullscreenToggle-DVdQriWB.cjs → FullscreenToggle-DXVAeN3M.cjs} +2 -2
  124. package/dist/{FullscreenToggle-DVdQriWB.cjs.map → FullscreenToggle-DXVAeN3M.cjs.map} +1 -1
  125. package/dist/Icon-BoQmbW7j.cjs +2 -0
  126. package/dist/Icon-BoQmbW7j.cjs.map +1 -0
  127. package/dist/{Icon-B7DJn8Tw.js → Icon-DMMO32p6.js} +72 -71
  128. package/dist/Icon-DMMO32p6.js.map +1 -0
  129. package/dist/{IconButton-DSPdv-oI.cjs → IconButton-ChhZqleN.cjs} +2 -2
  130. package/dist/{IconButton-DSPdv-oI.cjs.map → IconButton-ChhZqleN.cjs.map} +1 -1
  131. package/dist/{IconButton-iWbUJAz7.js → IconButton-s5hohjxu.js} +2 -2
  132. package/dist/{IconButton-iWbUJAz7.js.map → IconButton-s5hohjxu.js.map} +1 -1
  133. package/dist/{ImageEditor-C40dp2-V.cjs → ImageEditor-C8tFTX4e.cjs} +2 -2
  134. package/dist/{ImageEditor-C40dp2-V.cjs.map → ImageEditor-C8tFTX4e.cjs.map} +1 -1
  135. package/dist/{ImageEditor-BDNys8pq.js → ImageEditor-DWbWjGQ8.js} +8 -8
  136. package/dist/{ImageEditor-BDNys8pq.js.map → ImageEditor-DWbWjGQ8.js.map} +1 -1
  137. package/dist/{List-DS91CZUt.js → List-DQlEG_S5.js} +2 -2
  138. package/dist/{List-DS91CZUt.js.map → List-DQlEG_S5.js.map} +1 -1
  139. package/dist/{List-CLUXeaXS.cjs → List-Dfa7mlSZ.cjs} +2 -2
  140. package/dist/{List-CLUXeaXS.cjs.map → List-Dfa7mlSZ.cjs.map} +1 -1
  141. package/dist/{ListItem-Ezmdk7q-.js → ListItem-CLmg9xKQ.js} +2 -2
  142. package/dist/{ListItem-Ezmdk7q-.js.map → ListItem-CLmg9xKQ.js.map} +1 -1
  143. package/dist/{ListItem-CguNjf-u.cjs → ListItem-CWM2fUS2.cjs} +2 -2
  144. package/dist/{ListItem-CguNjf-u.cjs.map → ListItem-CWM2fUS2.cjs.map} +1 -1
  145. package/dist/{Loader-RyFTP2X5.cjs → Loader-BCrMy9NU.cjs} +2 -2
  146. package/dist/{Loader-RyFTP2X5.cjs.map → Loader-BCrMy9NU.cjs.map} +1 -1
  147. package/dist/{Loader-DD1vfqmN.js → Loader-CShIWNfG.js} +2 -2
  148. package/dist/{Loader-DD1vfqmN.js.map → Loader-CShIWNfG.js.map} +1 -1
  149. package/dist/{LocationPicker-B594f0bz.cjs → LocationPicker-8Tt0zJU4.cjs} +2 -2
  150. package/dist/{LocationPicker-B594f0bz.cjs.map → LocationPicker-8Tt0zJU4.cjs.map} +1 -1
  151. package/dist/{LocationPicker-DpmYaYyd.js → LocationPicker-DsV_s2Ur.js} +8 -8
  152. package/dist/{LocationPicker-DpmYaYyd.js.map → LocationPicker-DsV_s2Ur.js.map} +1 -1
  153. package/dist/{Modal-DVGTD2Ck.js → Modal-BO7fHn0r.js} +4 -4
  154. package/dist/{Modal-DVGTD2Ck.js.map → Modal-BO7fHn0r.js.map} +1 -1
  155. package/dist/{Modal-7cCok6fV.cjs → Modal-yj92WLay.cjs} +2 -2
  156. package/dist/{Modal-7cCok6fV.cjs.map → Modal-yj92WLay.cjs.map} +1 -1
  157. package/dist/{MultiSelect-DTKNjUDH.cjs → MultiSelect-B6JZb_5N.cjs} +2 -2
  158. package/dist/{MultiSelect-DTKNjUDH.cjs.map → MultiSelect-B6JZb_5N.cjs.map} +1 -1
  159. package/dist/{MultiSelect-D-X833xt.js → MultiSelect-D-QWlfwD.js} +5 -5
  160. package/dist/{MultiSelect-D-X833xt.js.map → MultiSelect-D-QWlfwD.js.map} +1 -1
  161. package/dist/{NumberField-Xz4yQMlm.cjs → NumberField-CS5VMnk4.cjs} +2 -2
  162. package/dist/{NumberField-Xz4yQMlm.cjs.map → NumberField-CS5VMnk4.cjs.map} +1 -1
  163. package/dist/{NumberField-OPOl0Yph.js → NumberField-D_UxKjVN.js} +4 -4
  164. package/dist/{NumberField-OPOl0Yph.js.map → NumberField-D_UxKjVN.js.map} +1 -1
  165. package/dist/{OtpField-kd0YghZq.cjs → OtpField-BuS_8j9L.cjs} +2 -2
  166. package/dist/{OtpField-kd0YghZq.cjs.map → OtpField-BuS_8j9L.cjs.map} +1 -1
  167. package/dist/{OtpField-CLrDMNtS.js → OtpField-CpjDid5_.js} +2 -2
  168. package/dist/{OtpField-CLrDMNtS.js.map → OtpField-CpjDid5_.js.map} +1 -1
  169. package/dist/{PageError-v6MAH_OL.cjs → PageError-CTEOASeb.cjs} +2 -2
  170. package/dist/{PageError-v6MAH_OL.cjs.map → PageError-CTEOASeb.cjs.map} +1 -1
  171. package/dist/{PageError-BIiZDzey.js → PageError-DjyJrGmR.js} +5 -5
  172. package/dist/{PageError-BIiZDzey.js.map → PageError-DjyJrGmR.js.map} +1 -1
  173. package/dist/{PageLayout-DH3jochw.cjs → PageLayout-BYKRmCAL.cjs} +2 -2
  174. package/dist/{PageLayout-DH3jochw.cjs.map → PageLayout-BYKRmCAL.cjs.map} +1 -1
  175. package/dist/{PageLayout-BjaPfXvb.js → PageLayout-Cz1OhQZ7.js} +5 -5
  176. package/dist/{PageLayout-BjaPfXvb.js.map → PageLayout-Cz1OhQZ7.js.map} +1 -1
  177. package/dist/{PageNotFound-C1oSsMG-.js → PageNotFound-CwBtrllo.js} +5 -5
  178. package/dist/{PageNotFound-C1oSsMG-.js.map → PageNotFound-CwBtrllo.js.map} +1 -1
  179. package/dist/{PageNotFound-Cse4bROv.cjs → PageNotFound-u9Q4KG6B.cjs} +2 -2
  180. package/dist/{PageNotFound-Cse4bROv.cjs.map → PageNotFound-u9Q4KG6B.cjs.map} +1 -1
  181. package/dist/{Pagination-BNJdqcu4.js → Pagination-CLjNwqie.js} +3 -3
  182. package/dist/{Pagination-BNJdqcu4.js.map → Pagination-CLjNwqie.js.map} +1 -1
  183. package/dist/{Pagination-DkmfEmgK.cjs → Pagination-HtS5gPnd.cjs} +2 -2
  184. package/dist/{Pagination-DkmfEmgK.cjs.map → Pagination-HtS5gPnd.cjs.map} +1 -1
  185. package/dist/{PaletteField-DqZl1mK0.cjs → PaletteField-BSgx5pxh.cjs} +2 -2
  186. package/dist/{PaletteField-DqZl1mK0.cjs.map → PaletteField-BSgx5pxh.cjs.map} +1 -1
  187. package/dist/{PaletteField-Cdky6Zka.js → PaletteField-Bk7cnSla.js} +3 -3
  188. package/dist/{PaletteField-Cdky6Zka.js.map → PaletteField-Bk7cnSla.js.map} +1 -1
  189. package/dist/{PhoneField-jq-3_i_b.cjs → PhoneField-CzFv2Vci.cjs} +2 -2
  190. package/dist/{PhoneField-jq-3_i_b.cjs.map → PhoneField-CzFv2Vci.cjs.map} +1 -1
  191. package/dist/{PhoneField-DmFaJJEa.js → PhoneField-DhoumZNG.js} +5 -5
  192. package/dist/{PhoneField-DmFaJJEa.js.map → PhoneField-DhoumZNG.js.map} +1 -1
  193. package/dist/{Popconfirm-KOE9gGi6.cjs → Popconfirm-Cb9LlmZb.cjs} +2 -2
  194. package/dist/{Popconfirm-KOE9gGi6.cjs.map → Popconfirm-Cb9LlmZb.cjs.map} +1 -1
  195. package/dist/{Popconfirm-D-8ZG2WR.js → Popconfirm-D7J5JbF-.js} +4 -4
  196. package/dist/{Popconfirm-D-8ZG2WR.js.map → Popconfirm-D7J5JbF-.js.map} +1 -1
  197. package/dist/{Progress-CdX666FP.js → Progress-Bt2LDqbD.js} +2 -2
  198. package/dist/{Progress-CdX666FP.js.map → Progress-Bt2LDqbD.js.map} +1 -1
  199. package/dist/{Progress-7EyhPtnu.cjs → Progress-dAtQ2BN-.cjs} +2 -2
  200. package/dist/{Progress-7EyhPtnu.cjs.map → Progress-dAtQ2BN-.cjs.map} +1 -1
  201. package/dist/{QrCode-ClIJjjvF.cjs → QrCode-FHUAxI8u.cjs} +2 -2
  202. package/dist/{QrCode-ClIJjjvF.cjs.map → QrCode-FHUAxI8u.cjs.map} +1 -1
  203. package/dist/{QrCode-D7ocSDi7.js → QrCode-jaDZxZkv.js} +2 -2
  204. package/dist/{QrCode-D7ocSDi7.js.map → QrCode-jaDZxZkv.js.map} +1 -1
  205. package/dist/{RemoveDialog-DTzRPLaT.js → RemoveDialog-DdO5E3Wl.js} +6 -6
  206. package/dist/{RemoveDialog-DTzRPLaT.js.map → RemoveDialog-DdO5E3Wl.js.map} +1 -1
  207. package/dist/{RemoveDialog-UsSX5z8Y.cjs → RemoveDialog-eGNxdyoO.cjs} +2 -2
  208. package/dist/{RemoveDialog-UsSX5z8Y.cjs.map → RemoveDialog-eGNxdyoO.cjs.map} +1 -1
  209. package/dist/{RichTextEditor-Bh0Q3dIW.cjs → RichTextEditor-CoYuQurR.cjs} +2 -2
  210. package/dist/{RichTextEditor-Bh0Q3dIW.cjs.map → RichTextEditor-CoYuQurR.cjs.map} +1 -1
  211. package/dist/{RichTextEditor-BMctlkVC.js → RichTextEditor-DHRiJchI.js} +10 -10
  212. package/dist/{RichTextEditor-BMctlkVC.js.map → RichTextEditor-DHRiJchI.js.map} +1 -1
  213. package/dist/{RootLayout-BztZetpk.cjs → RootLayout-CEplIlVR.cjs} +2 -2
  214. package/dist/{RootLayout-BztZetpk.cjs.map → RootLayout-CEplIlVR.cjs.map} +1 -1
  215. package/dist/{RootLayout-CTkv4iQJ.js → RootLayout-pd66MZtI.js} +21 -21
  216. package/dist/{RootLayout-CTkv4iQJ.js.map → RootLayout-pd66MZtI.js.map} +1 -1
  217. package/dist/{Select-CmonDIIU.js → Select-C2iiQLMh.js} +4 -4
  218. package/dist/{Select-CmonDIIU.js.map → Select-C2iiQLMh.js.map} +1 -1
  219. package/dist/{Select-BzVyK6Ne.cjs → Select-CvW_T9R-.cjs} +2 -2
  220. package/dist/{Select-BzVyK6Ne.cjs.map → Select-CvW_T9R-.cjs.map} +1 -1
  221. package/dist/Sidebar-CqGCazeA.cjs +2 -0
  222. package/dist/Sidebar-CqGCazeA.cjs.map +1 -0
  223. package/dist/Sidebar-DuUhzQBi.js +543 -0
  224. package/dist/Sidebar-DuUhzQBi.js.map +1 -0
  225. package/dist/{Slider-Oe9VSAdy.cjs → Slider-DlPMPdHA.cjs} +2 -2
  226. package/dist/{Slider-Oe9VSAdy.cjs.map → Slider-DlPMPdHA.cjs.map} +1 -1
  227. package/dist/{Slider-C7Wb3q_F.js → Slider-UY29adRu.js} +2 -2
  228. package/dist/{Slider-C7Wb3q_F.js.map → Slider-UY29adRu.js.map} +1 -1
  229. package/dist/{SpeedDial-DpIXoYHB.cjs → SpeedDial-Cms5pJ9t.cjs} +2 -2
  230. package/dist/{SpeedDial-DpIXoYHB.cjs.map → SpeedDial-Cms5pJ9t.cjs.map} +1 -1
  231. package/dist/{SpeedDial-CCGQlwn2.js → SpeedDial-DOWefQgo.js} +3 -3
  232. package/dist/{SpeedDial-CCGQlwn2.js.map → SpeedDial-DOWefQgo.js.map} +1 -1
  233. package/dist/{Stepper-PBDU60G_.cjs → Stepper-4wCyTnwi.cjs} +2 -2
  234. package/dist/{Stepper-PBDU60G_.cjs.map → Stepper-4wCyTnwi.cjs.map} +1 -1
  235. package/dist/{Stepper-D_WKS1RG.js → Stepper-yQEJkbUJ.js} +3 -3
  236. package/dist/{Stepper-D_WKS1RG.js.map → Stepper-yQEJkbUJ.js.map} +1 -1
  237. package/dist/{SwatchPicker-DS4WY2eM.js → SwatchPicker-BI0XHphv.js} +2 -2
  238. package/dist/{SwatchPicker-DS4WY2eM.js.map → SwatchPicker-BI0XHphv.js.map} +1 -1
  239. package/dist/{SwatchPicker-DCjE0T80.cjs → SwatchPicker-QYtqEUxX.cjs} +2 -2
  240. package/dist/{SwatchPicker-DCjE0T80.cjs.map → SwatchPicker-QYtqEUxX.cjs.map} +1 -1
  241. package/dist/{Table-DZQVa_PE.js → Table-CNrt1EWm.js} +19 -19
  242. package/dist/{Table-DZQVa_PE.js.map → Table-CNrt1EWm.js.map} +1 -1
  243. package/dist/{Table-CZ4n4-TN.cjs → Table-D4pqLNtE.cjs} +2 -2
  244. package/dist/{Table-CZ4n4-TN.cjs.map → Table-D4pqLNtE.cjs.map} +1 -1
  245. package/dist/{Tabs-Byhqm-TE.cjs → Tabs-D6qrgZTM.cjs} +2 -2
  246. package/dist/{Tabs-Byhqm-TE.cjs.map → Tabs-D6qrgZTM.cjs.map} +1 -1
  247. package/dist/{Tabs-B063mP-v.js → Tabs-lezN63jW.js} +3 -3
  248. package/dist/{Tabs-B063mP-v.js.map → Tabs-lezN63jW.js.map} +1 -1
  249. package/dist/{TagsField-g_LtwYgz.cjs → TagsField-BIJEDyfz.cjs} +2 -2
  250. package/dist/{TagsField-g_LtwYgz.cjs.map → TagsField-BIJEDyfz.cjs.map} +1 -1
  251. package/dist/{TagsField-hQFYyNcM.js → TagsField-D_a2I8eU.js} +5 -5
  252. package/dist/{TagsField-hQFYyNcM.js.map → TagsField-D_a2I8eU.js.map} +1 -1
  253. package/dist/{TextField-Dfpk0jOg.js → TextField-BsC2zoHI.js} +4 -4
  254. package/dist/{TextField-Dfpk0jOg.js.map → TextField-BsC2zoHI.js.map} +1 -1
  255. package/dist/{TextField-D4s2hGSd.cjs → TextField-CXDBlP-8.cjs} +2 -2
  256. package/dist/{TextField-D4s2hGSd.cjs.map → TextField-CXDBlP-8.cjs.map} +1 -1
  257. package/dist/{ThemeToggle-BQQ3eswr.js → ThemeToggle-Dh6XxqM7.js} +4 -4
  258. package/dist/{ThemeToggle-BQQ3eswr.js.map → ThemeToggle-Dh6XxqM7.js.map} +1 -1
  259. package/dist/{ThemeToggle-BTTI7Jz0.cjs → ThemeToggle-zbKf4ph5.cjs} +2 -2
  260. package/dist/{ThemeToggle-BTTI7Jz0.cjs.map → ThemeToggle-zbKf4ph5.cjs.map} +1 -1
  261. package/dist/{TimeColumns-BpjhrNCq.js → TimeColumns-CR__2LXh.js} +2 -2
  262. package/dist/{TimeColumns-BpjhrNCq.js.map → TimeColumns-CR__2LXh.js.map} +1 -1
  263. package/dist/{TimeColumns-DZYGWWG_.cjs → TimeColumns-CjBeUPtV.cjs} +2 -2
  264. package/dist/{TimeColumns-DZYGWWG_.cjs.map → TimeColumns-CjBeUPtV.cjs.map} +1 -1
  265. package/dist/{TimePicker-mzoMIlpq.js → TimePicker-BakQ-wPd.js} +6 -6
  266. package/dist/{TimePicker-mzoMIlpq.js.map → TimePicker-BakQ-wPd.js.map} +1 -1
  267. package/dist/{TimePicker-DChtZgBs.cjs → TimePicker-DtqmD2bH.cjs} +2 -2
  268. package/dist/{TimePicker-DChtZgBs.cjs.map → TimePicker-DtqmD2bH.cjs.map} +1 -1
  269. package/dist/{Timeline-DOojNvLG.cjs → Timeline-CFKbPpAV.cjs} +2 -2
  270. package/dist/{Timeline-DOojNvLG.cjs.map → Timeline-CFKbPpAV.cjs.map} +1 -1
  271. package/dist/{Timeline-Dg03dwTN.js → Timeline-zCHcq7Ra.js} +2 -2
  272. package/dist/{Timeline-Dg03dwTN.js.map → Timeline-zCHcq7Ra.js.map} +1 -1
  273. package/dist/{Toaster-lonArt-H.cjs → Toaster-BpXPWJ_n.cjs} +2 -2
  274. package/dist/{Toaster-lonArt-H.cjs.map → Toaster-BpXPWJ_n.cjs.map} +1 -1
  275. package/dist/{Toaster-79DvOW80.js → Toaster-C5jWNL-o.js} +3 -3
  276. package/dist/{Toaster-79DvOW80.js.map → Toaster-C5jWNL-o.js.map} +1 -1
  277. package/dist/{ToggleButtonGroup-CGNRLxjg.cjs → ToggleButtonGroup-CbKtjm8O.cjs} +2 -2
  278. package/dist/{ToggleButtonGroup-CGNRLxjg.cjs.map → ToggleButtonGroup-CbKtjm8O.cjs.map} +1 -1
  279. package/dist/{ToggleButtonGroup-K6ZcrTZT.js → ToggleButtonGroup-D3Jltv0z.js} +2 -2
  280. package/dist/{ToggleButtonGroup-K6ZcrTZT.js.map → ToggleButtonGroup-D3Jltv0z.js.map} +1 -1
  281. package/dist/{TranslatedFields-CHHtXO_n.js → TranslatedFields-C8oxlGIQ.js} +5 -5
  282. package/dist/{TranslatedFields-CHHtXO_n.js.map → TranslatedFields-C8oxlGIQ.js.map} +1 -1
  283. package/dist/{TranslatedFields-BYpMrYaw.cjs → TranslatedFields-Che_ZPHk.cjs} +2 -2
  284. package/dist/{TranslatedFields-BYpMrYaw.cjs.map → TranslatedFields-Che_ZPHk.cjs.map} +1 -1
  285. package/dist/{UserCard-SlkCgZS9.cjs → UserCard-DlrdIJHW.cjs} +2 -2
  286. package/dist/{UserCard-SlkCgZS9.cjs.map → UserCard-DlrdIJHW.cjs.map} +1 -1
  287. package/dist/{UserCard-BJFNP_nl.js → UserCard-Dr1A_bdA.js} +5 -5
  288. package/dist/{UserCard-BJFNP_nl.js.map → UserCard-Dr1A_bdA.js.map} +1 -1
  289. package/dist/auth/AuthGuard.d.cts +3 -1
  290. package/dist/auth/AuthGuard.d.ts +3 -1
  291. package/dist/auth/authLayoutRoute.d.cts +4 -3
  292. package/dist/auth/authLayoutRoute.d.ts +4 -3
  293. package/dist/auth/authRedirect.d.cts +13 -5
  294. package/dist/auth/authRedirect.d.ts +13 -5
  295. package/dist/{authLayoutRoute-AiQqIH85.cjs → authLayoutRoute-CPLqQVvx.cjs} +2 -2
  296. package/dist/authLayoutRoute-CPLqQVvx.cjs.map +1 -0
  297. package/dist/{authLayoutRoute-Nf2PDNDN.js → authLayoutRoute-nSZq8JYA.js} +2 -2
  298. package/dist/authLayoutRoute-nSZq8JYA.js.map +1 -0
  299. package/dist/chunks/icons/{62-Bfupp-0A.js → 62-9nuZO-ct.js} +9 -10
  300. package/dist/chunks/icons/{62-CZZzM1ev.cjs → 62-DQQ1U3IB.cjs} +1 -1
  301. package/dist/components/Accordion/index.cjs +1 -1
  302. package/dist/components/Accordion/index.js +1 -1
  303. package/dist/components/Alert/index.cjs +1 -1
  304. package/dist/components/Alert/index.js +1 -1
  305. package/dist/components/AuthLayout/index.cjs +1 -1
  306. package/dist/components/AuthLayout/index.js +1 -1
  307. package/dist/components/Avatar/index.cjs +1 -1
  308. package/dist/components/Avatar/index.js +2 -2
  309. package/dist/components/Breadcrumbs/index.cjs +1 -1
  310. package/dist/components/Breadcrumbs/index.js +1 -1
  311. package/dist/components/Button/index.cjs +1 -1
  312. package/dist/components/Button/index.js +1 -1
  313. package/dist/components/Card/index.cjs +1 -1
  314. package/dist/components/Card/index.js +1 -1
  315. package/dist/components/Chip/index.cjs +1 -1
  316. package/dist/components/Chip/index.js +1 -1
  317. package/dist/components/ChoiceCard/index.cjs +1 -1
  318. package/dist/components/ChoiceCard/index.js +1 -1
  319. package/dist/components/CodeBlock/index.cjs +1 -1
  320. package/dist/components/CodeBlock/index.js +1 -1
  321. package/dist/components/ColorPicker/index.cjs +1 -1
  322. package/dist/components/ColorPicker/index.js +1 -1
  323. package/dist/components/ColorRamp/index.cjs +1 -1
  324. package/dist/components/ColorRamp/index.js +1 -1
  325. package/dist/components/CopyButton/index.cjs +1 -1
  326. package/dist/components/CopyButton/index.js +1 -1
  327. package/dist/components/DashedButton/index.cjs +1 -1
  328. package/dist/components/DashedButton/index.js +1 -1
  329. package/dist/components/DatePicker/index.cjs +1 -1
  330. package/dist/components/DatePicker/index.js +1 -1
  331. package/dist/components/DateTimePicker/index.cjs +1 -1
  332. package/dist/components/DateTimePicker/index.js +1 -1
  333. package/dist/components/DescriptionList/index.cjs +1 -1
  334. package/dist/components/DescriptionList/index.js +1 -1
  335. package/dist/components/Dropdown/index.cjs +1 -1
  336. package/dist/components/Dropdown/index.js +1 -1
  337. package/dist/components/EmptyState/index.cjs +1 -1
  338. package/dist/components/EmptyState/index.js +1 -1
  339. package/dist/components/ErrorState/index.cjs +1 -1
  340. package/dist/components/ErrorState/index.js +2 -2
  341. package/dist/components/FileCard/index.cjs +1 -1
  342. package/dist/components/FileCard/index.js +1 -1
  343. package/dist/components/FileUploader/index.cjs +1 -1
  344. package/dist/components/FileUploader/index.js +1 -1
  345. package/dist/components/Flag/index.cjs +1 -1
  346. package/dist/components/Flag/index.js +1 -1
  347. package/dist/components/FullscreenToggle/index.cjs +1 -1
  348. package/dist/components/FullscreenToggle/index.js +1 -1
  349. package/dist/components/Icon/index.cjs +1 -1
  350. package/dist/components/Icon/index.js +1 -1
  351. package/dist/components/IconButton/index.cjs +1 -1
  352. package/dist/components/IconButton/index.js +1 -1
  353. package/dist/components/ImageEditor/index.cjs +1 -1
  354. package/dist/components/ImageEditor/index.js +1 -1
  355. package/dist/components/List/index.cjs +1 -1
  356. package/dist/components/List/index.js +2 -2
  357. package/dist/components/Loader/index.cjs +1 -1
  358. package/dist/components/Loader/index.js +1 -1
  359. package/dist/components/LocationPicker/index.cjs +1 -1
  360. package/dist/components/LocationPicker/index.js +1 -1
  361. package/dist/components/Modal/index.cjs +1 -1
  362. package/dist/components/Modal/index.js +1 -1
  363. package/dist/components/MultiSelect/index.cjs +1 -1
  364. package/dist/components/MultiSelect/index.js +1 -1
  365. package/dist/components/NumberField/index.cjs +1 -1
  366. package/dist/components/NumberField/index.js +1 -1
  367. package/dist/components/OtpField/index.cjs +1 -1
  368. package/dist/components/OtpField/index.js +1 -1
  369. package/dist/components/PageError/index.cjs +1 -1
  370. package/dist/components/PageError/index.js +1 -1
  371. package/dist/components/PageLayout/index.cjs +1 -1
  372. package/dist/components/PageLayout/index.js +1 -1
  373. package/dist/components/PageNotFound/index.cjs +1 -1
  374. package/dist/components/PageNotFound/index.js +1 -1
  375. package/dist/components/Pagination/index.cjs +1 -1
  376. package/dist/components/Pagination/index.js +1 -1
  377. package/dist/components/PaletteField/index.cjs +1 -1
  378. package/dist/components/PaletteField/index.js +1 -1
  379. package/dist/components/PhoneField/index.cjs +1 -1
  380. package/dist/components/PhoneField/index.js +1 -1
  381. package/dist/components/Popconfirm/index.cjs +1 -1
  382. package/dist/components/Popconfirm/index.js +1 -1
  383. package/dist/components/Progress/index.cjs +1 -1
  384. package/dist/components/Progress/index.js +1 -1
  385. package/dist/components/QrCode/index.cjs +1 -1
  386. package/dist/components/QrCode/index.js +1 -1
  387. package/dist/components/RemoveDialog/index.cjs +1 -1
  388. package/dist/components/RemoveDialog/index.js +1 -1
  389. package/dist/components/RichTextEditor/index.cjs +1 -1
  390. package/dist/components/RichTextEditor/index.js +1 -1
  391. package/dist/components/RootLayout/index.cjs +1 -1
  392. package/dist/components/RootLayout/index.js +1 -1
  393. package/dist/components/Select/index.cjs +1 -1
  394. package/dist/components/Select/index.js +1 -1
  395. package/dist/components/Sidebar/Sidebar.d.cts +40 -4
  396. package/dist/components/Sidebar/Sidebar.d.ts +40 -4
  397. package/dist/components/Sidebar/index.cjs +1 -1
  398. package/dist/components/Sidebar/index.d.cts +2 -1
  399. package/dist/components/Sidebar/index.d.ts +2 -1
  400. package/dist/components/Sidebar/index.js +5 -4
  401. package/dist/components/Slider/index.cjs +1 -1
  402. package/dist/components/Slider/index.js +1 -1
  403. package/dist/components/SpeedDial/index.cjs +1 -1
  404. package/dist/components/SpeedDial/index.js +1 -1
  405. package/dist/components/Stepper/index.cjs +1 -1
  406. package/dist/components/Stepper/index.js +1 -1
  407. package/dist/components/SwatchPicker/index.cjs +1 -1
  408. package/dist/components/SwatchPicker/index.js +1 -1
  409. package/dist/components/Table/index.cjs +1 -1
  410. package/dist/components/Table/index.js +1 -1
  411. package/dist/components/Tabs/index.cjs +1 -1
  412. package/dist/components/Tabs/index.js +1 -1
  413. package/dist/components/TagsField/index.cjs +1 -1
  414. package/dist/components/TagsField/index.js +1 -1
  415. package/dist/components/TextField/index.cjs +1 -1
  416. package/dist/components/TextField/index.js +1 -1
  417. package/dist/components/ThemeToggle/index.cjs +1 -1
  418. package/dist/components/ThemeToggle/index.js +1 -1
  419. package/dist/components/TimePicker/index.cjs +1 -1
  420. package/dist/components/TimePicker/index.js +1 -1
  421. package/dist/components/Timeline/index.cjs +1 -1
  422. package/dist/components/Timeline/index.js +1 -1
  423. package/dist/components/Toast/index.cjs +1 -1
  424. package/dist/components/Toast/index.js +1 -1
  425. package/dist/components/ToggleButton/index.cjs +1 -1
  426. package/dist/components/ToggleButton/index.js +1 -1
  427. package/dist/components/TranslatedFields/index.cjs +1 -1
  428. package/dist/components/TranslatedFields/index.js +1 -1
  429. package/dist/components/UserCard/index.cjs +1 -1
  430. package/dist/components/UserCard/index.js +1 -1
  431. package/dist/entries/app.cjs +1 -1
  432. package/dist/entries/app.js +1 -1
  433. package/dist/entries/auth.cjs +1 -1
  434. package/dist/entries/auth.js +2 -2
  435. package/dist/entries/components.cjs +1 -1
  436. package/dist/entries/components.js +157 -156
  437. package/dist/entries/i18n.cjs +1 -1
  438. package/dist/entries/i18n.js +2 -2
  439. package/dist/entries/icons.cjs +1 -1
  440. package/dist/entries/icons.js +1 -1
  441. package/dist/entries/theme.cjs +1 -1
  442. package/dist/entries/theme.js +1 -1
  443. package/dist/i18n/messages.d.cts +4 -0
  444. package/dist/i18n/messages.d.ts +4 -0
  445. package/dist/index.cjs +1 -1
  446. package/dist/index.css +1 -1
  447. package/dist/index.js +173 -172
  448. package/dist/{messages-DeQuvGln.js → messages-CZbb1xNN.js} +29 -15
  449. package/dist/messages-CZbb1xNN.js.map +1 -0
  450. package/dist/messages-D4ooXnUr.cjs +36 -0
  451. package/dist/messages-D4ooXnUr.cjs.map +1 -0
  452. package/dist/useHomeTo---51HTJ0.cjs +2 -0
  453. package/dist/useHomeTo---51HTJ0.cjs.map +1 -0
  454. package/dist/useHomeTo-CJj94TdV.js +10 -0
  455. package/dist/useHomeTo-CJj94TdV.js.map +1 -0
  456. package/dist/{useOptionMenu-6ZffgbYG.cjs → useOptionMenu-DS___46k.cjs} +2 -2
  457. package/dist/{useOptionMenu-6ZffgbYG.cjs.map → useOptionMenu-DS___46k.cjs.map} +1 -1
  458. package/dist/{useOptionMenu-CxM6FHXL.js → useOptionMenu-Sp2d3Bzi.js} +6 -6
  459. package/dist/{useOptionMenu-CxM6FHXL.js.map → useOptionMenu-Sp2d3Bzi.js.map} +1 -1
  460. package/package.json +1 -1
  461. package/dist/AuthGuard-BTSRwF04.js +0 -108
  462. package/dist/AuthGuard-BTSRwF04.js.map +0 -1
  463. package/dist/AuthGuard-CLqroYbX.cjs +0 -2
  464. package/dist/AuthGuard-CLqroYbX.cjs.map +0 -1
  465. package/dist/Icon-B7DJn8Tw.js.map +0 -1
  466. package/dist/Icon-CBg21lKA.cjs +0 -2
  467. package/dist/Icon-CBg21lKA.cjs.map +0 -1
  468. package/dist/Sidebar-CLr-DyQ_.js +0 -522
  469. package/dist/Sidebar-CLr-DyQ_.js.map +0 -1
  470. package/dist/Sidebar-CM-jZfj5.cjs +0 -2
  471. package/dist/Sidebar-CM-jZfj5.cjs.map +0 -1
  472. package/dist/authLayoutRoute-AiQqIH85.cjs.map +0 -1
  473. package/dist/authLayoutRoute-Nf2PDNDN.js.map +0 -1
  474. package/dist/messages-DeQuvGln.js.map +0 -1
  475. package/dist/messages-dL9MkVze.cjs +0 -36
  476. package/dist/messages-dL9MkVze.cjs.map +0 -1
  477. package/dist/useHomeTo-BLSvhJd5.js +0 -25
  478. package/dist/useHomeTo-BLSvhJd5.js.map +0 -1
  479. package/dist/useHomeTo-cXCg1tf0.cjs +0 -2
  480. package/dist/useHomeTo-cXCg1tf0.cjs.map +0 -1
@@ -3,7 +3,7 @@ import { useContext as P, createContext as R, forwardRef as j, useState as w, us
3
3
  import { clsx as k } from "clsx";
4
4
  import { u as J } from "./formContext-B7ln1Miy.js";
5
5
  import { T as K } from "./Typography-ChSuxgkc.js";
6
- import { b as Q, a as U } from "./Icon-B7DJn8Tw.js";
6
+ import { b as Q, a as U } from "./Icon-DMMO32p6.js";
7
7
  const F = R(null);
8
8
  function W() {
9
9
  return P(F);
@@ -177,4 +177,4 @@ export {
177
177
  he as C,
178
178
  Ae as a
179
179
  };
180
- //# sourceMappingURL=ChoiceCardGroup-D37XREKV.js.map
180
+ //# sourceMappingURL=ChoiceCardGroup-BBqUbFLS.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceCardGroup-D37XREKV.js","sources":["../src/components/ChoiceCard/choiceCardContext.ts","../src/components/ChoiceCard/ChoiceCard.tsx","../src/components/ChoiceCard/ChoiceCardGroup.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { ThemeColor } from '../../theme'\nimport type { ChoiceCardAlign, ChoiceCardSize } from './ChoiceCard'\n\n/** Shared state a `<ChoiceCardGroup>` hands down to its `<ChoiceCard>` children via context. */\nexport interface ChoiceCardGroupContextValue {\n /** Shared input `name` — in `exclusive` mode the cards are native radios and must share one. */\n name?: string\n /** Single-selection (radio semantics) vs multiple (checkbox semantics). */\n exclusive: boolean\n /** Whether a card's value is currently selected. */\n isSelected: (value: string) => boolean\n /** Select / toggle a value — called by a child `<ChoiceCard>` on change. */\n toggle: (value: string) => void\n size?: ChoiceCardSize\n align?: ChoiceCardAlign\n color?: ThemeColor\n disabled?: boolean\n error?: boolean\n}\n\nexport const ChoiceCardGroupContext = createContext<ChoiceCardGroupContextValue | null>(null)\n\n/** Read the surrounding `<ChoiceCardGroup>` so a `<ChoiceCard>` can wire itself in (or `null` when standalone). */\nexport function useChoiceCardGroupContext(): ChoiceCardGroupContextValue | null {\n return useContext(ChoiceCardGroupContext)\n}\n","import {\n forwardRef,\n useState,\n type ChangeEvent,\n type CSSProperties,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport type { ThemeColor } from '../../theme'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { useChoiceCardGroupContext } from './choiceCardContext'\nimport styles from './ChoiceCard.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type ChoiceCardSize = 'sm' | 'md' | 'lg'\nexport type ChoiceCardAlign = 'left' | 'center'\n\nexport interface ChoiceCardProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'color' | 'type' | 'onChange' | 'value'\n> {\n /** This card's value — selected when the surrounding `ChoiceCardGroup`'s value holds it. */\n value: string\n /** Card title. */\n label?: ReactNode\n /** Muted description line under the title. */\n description?: ReactNode\n /** Leading icon in a tinted circle — a known `IconName` or any node. Optional. */\n icon?: IconName | ReactNode\n /**\n * Content alignment. `center` centers the icon + text stack; `left` anchors the same stack to the\n * left edge (icon above left-aligned text). Defaults to the group's `align`, else `center` with an\n * icon and `left` without one.\n */\n align?: ChoiceCardAlign\n /** Theme palette token for the selected tint. Defaults to `primary` (inherits the group's `color`). */\n color?: ThemeColor\n /** Preset size — padding, icon circle and fonts. Inherits the group's `size` when omitted. */\n size?: ChoiceCardSize\n /** Marks the card invalid — reddens the border + indicator. Inherits the group's `error`. */\n error?: boolean\n /** Controlled selected state for standalone use (inside a `ChoiceCardGroup` the group drives this). */\n checked?: boolean\n /** Fires with the next selected state (standalone use). */\n onChange?: (checked: boolean) => void\n}\n\n/**\n * A selectable card — a rich checkbox/radio with an icon, title and description. The native input is\n * visually hidden but fully accessible (Space toggles; in an `exclusive` group the cards are real\n * radios, so Arrow keys rove between them); the card shows the state with a `color` border + soft halo,\n * a top-right tick indicator, and an icon circle that fills with the color while selected. Designed to\n * live inside a `<ChoiceCardGroup>` (which supplies the selection, `exclusive` mode and\n * `size`/`color`/`disabled`/`error` via context), but also works standalone as a single fancy checkbox\n * (`checked` + `onChange`). Styling uses `--tz-*` tokens via the shared `--tz-btn-rgb` pattern.\n */\nexport const ChoiceCard = forwardRef<HTMLInputElement, ChoiceCardProps>(function ChoiceCard(\n {\n value,\n label,\n description,\n icon,\n align,\n color,\n size,\n error,\n checked,\n onChange,\n name,\n disabled,\n className,\n style,\n ...props\n },\n ref,\n) {\n const group = useChoiceCardGroupContext()\n\n const resolvedColor = color ?? group?.color ?? 'primary'\n const resolvedSize = size ?? group?.size ?? 'md'\n const resolvedError = error ?? group?.error ?? false\n const resolvedDisabled = disabled ?? group?.disabled ?? false\n const resolvedName = name ?? group?.name\n // explicit prop → group's align → smart default (an icon centers the card, no icon reads as a row)\n const resolvedAlign = align ?? group?.align ?? (icon == null ? 'left' : 'center')\n\n // In a group the selection comes from context; standalone it's controlled (`checked`) or local.\n const [internal, setInternal] = useState(false)\n const isChecked = group ? group.isSelected(value) : checked !== undefined ? checked : internal\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (resolvedDisabled) return\n if (group) {\n group.toggle(value)\n return\n }\n if (checked === undefined) setInternal(event.target.checked)\n onChange?.(event.target.checked)\n }\n\n const iconNode =\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} size={resolvedSize} />\n ) : (\n icon\n )\n\n return (\n <label\n className={clsx(\n styles.card,\n styles[resolvedSize],\n resolvedAlign === 'left' && styles.left,\n isChecked && styles.selected,\n resolvedError && styles.error,\n resolvedDisabled && styles.disabled,\n className,\n )}\n style={\n {\n '--tz-btn-rgb': `var(--tz-color-${resolvedColor}-rgb)`,\n '--tz-btn-on': `var(--tz-color-${resolvedColor}-contrast, #fff)`,\n ...style,\n } as CSSProperties\n }\n >\n <input\n ref={ref}\n type={group?.exclusive ? 'radio' : 'checkbox'}\n className={styles.input}\n name={resolvedName}\n value={value}\n checked={isChecked}\n onChange={handleChange}\n disabled={resolvedDisabled}\n aria-invalid={resolvedError || undefined}\n {...props}\n />\n {/* top-right selection indicator — radio-style ring + dot in exclusive groups (mirrors Radio),\n else a circle that fills with the theme color + a CSS tick (checkbox semantics) */}\n <span\n className={clsx(styles.indicator, group?.exclusive && styles.radioDot)}\n aria-hidden=\"true\"\n />\n {icon != null && (\n <span className={styles.iconBox} aria-hidden=\"true\">\n {iconNode}\n </span>\n )}\n {(label != null || description != null) && (\n <span className={styles.text}>\n {label != null && <span className={styles.label}>{label}</span>}\n {description != null && <span className={styles.description}>{description}</span>}\n </span>\n )}\n </label>\n )\n})\n","import {\n forwardRef,\n useId,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport type { ThemeColor } from '../../theme'\nimport type { IconName } from '../../icons/names'\nimport { Typography } from '../Typography'\nimport { ChoiceCard, type ChoiceCardAlign, type ChoiceCardSize } from './ChoiceCard'\nimport { ChoiceCardGroupContext, type ChoiceCardGroupContextValue } from './choiceCardContext'\nimport styles from './ChoiceCard.module.css'\n\n/** A single card for the data-driven `options` prop. */\nexport interface ChoiceCardOption {\n value: string\n /** Card title. */\n label?: ReactNode\n /** Muted description line under the title. */\n description?: ReactNode\n /** Leading icon in a tinted circle — a known `IconName` or any node. */\n icon?: IconName | ReactNode\n disabled?: boolean\n}\n\nexport interface ChoiceCardGroupProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'color' | 'onChange' | 'defaultValue'\n> {\n /**\n * Single-selection (radio semantics — the cards are native radios, `value` is a `string | null`,\n * clicking the selected card keeps it selected) vs multiple (checkbox semantics — `value` is a\n * `string[]`). Defaults to `false` (multiple).\n */\n exclusive?: boolean\n /** Controlled value — a `string | null` when `exclusive`, else a `string[]`. */\n value?: string | string[] | null\n /** Initial value for uncontrolled use (same shape as `value`). */\n defaultValue?: string | string[] | null\n /** Fires with the next value (matches the `exclusive` shape). */\n onChange?: (value: string | string[] | null) => void\n /**\n * Input `name` — shared by the radios in `exclusive` mode, and the `<Form>` binding key (form value:\n * `string` when `exclusive`, else `string[]`). Auto-generated when omitted.\n */\n name?: string\n /** Data-driven cards — an alternative to passing `<ChoiceCard>` children. */\n options?: ChoiceCardOption[]\n /** Group label rendered above the cards. */\n label?: ReactNode\n /** Minimum card width in px — the grid fits as many per row as this allows. Defaults to `160`. */\n minCardWidth?: number\n /**\n * Content alignment for every card. `center` centers the icon + text stack; `left` anchors the same\n * stack to the left edge (icon above left-aligned text). Omit for the smart default — cards with an\n * icon center, icon-less cards left-align. A card's own `align` wins.\n */\n align?: ChoiceCardAlign\n /** Preset size for every card. Defaults to `md`. */\n size?: ChoiceCardSize\n /** Theme palette token for the selected tint. Defaults to `primary`. */\n color?: ThemeColor\n /** Marks the group invalid — reddens the card borders (no message text, like `RadioGroup`). */\n error?: boolean\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Disables every card in the group. */\n disabled?: boolean\n /** `<ChoiceCard>` children (used when `options` is not given). */\n children?: ReactNode\n}\n\n/**\n * A group of selectable cards — rich checkboxes/radios with icons, titles and descriptions (role\n * pickers, plan choices, permission sets). **`exclusive`** picks single-selection (radio semantics —\n * `value` is a `string | null` and Arrow keys rove between the cards) vs multiple (checkbox semantics —\n * `value` is a `string[]`); defaults to `false` (multiple). Controlled (`value` + `onChange`) or\n * uncontrolled (`defaultValue`); supply the cards via the data-driven `options` prop (`{ value, label,\n * description?, icon?, disabled? }[]`) or as `<ChoiceCard>` children. The cards lay out on a\n * **responsive grid** (`minCardWidth`, default `160` — as many per row as fit, wrapping below). Binds\n * to a surrounding `<Form>` by **`name`** — the form value is a `string` when `exclusive` (validate\n * with e.g. `z.string().min(1)`), else a `string[]` (`z.array(z.string()).min(1)`); the form's `error`\n * reddens the card borders (no message text, like `RadioGroup`). `role=\"radiogroup\"` / `\"group\"`;\n * styling uses `--tz-*` tokens via the shared `--tz-btn-rgb` pattern.\n */\nexport const ChoiceCardGroup = forwardRef<HTMLDivElement, ChoiceCardGroupProps>(\n function ChoiceCardGroup(\n {\n exclusive = false,\n value,\n defaultValue,\n onChange,\n name,\n options,\n label,\n minCardWidth = 160,\n align,\n size = 'md',\n color = 'primary',\n error,\n required = false,\n disabled = false,\n children,\n className,\n style,\n ...props\n },\n ref,\n ) {\n // exclusive cards are native radios — they need a shared input name even without a form\n const reactId = useId()\n const resolvedName = name ?? `choice-${reactId}`\n\n // Auto-bind to a surrounding <Form> by `name` — the form value mirrors the `exclusive` shape.\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue: string | string[] | null | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? (form!.values[name!] as string | string[] | null | undefined)\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<string | string[] | null | undefined>(defaultValue)\n const current = isControlled ? externalValue : internal\n\n const resolvedError = error ?? bound?.error ?? false\n\n const isSelected = (v: string) =>\n exclusive ? current === v : Array.isArray(current) && current.includes(v)\n\n const toggle = (v: string) => {\n let next: string | string[] | null\n if (exclusive) {\n next = v // radio semantics — selecting again keeps it selected\n } else {\n const arr = Array.isArray(current) ? current : []\n next = arr.includes(v) ? arr.filter((x) => x !== v) : [...arr, v]\n }\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n const ctx: ChoiceCardGroupContextValue = {\n name: resolvedName,\n exclusive,\n isSelected,\n toggle,\n size,\n align,\n color,\n disabled,\n error: resolvedError,\n }\n\n return (\n <div\n ref={ref}\n role={exclusive ? 'radiogroup' : 'group'}\n aria-invalid={resolvedError || undefined}\n className={clsx(styles.group, className)}\n style={style as CSSProperties}\n {...props}\n >\n {label != null && (\n <span className={styles.groupLabel}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n )}\n\n <div className={styles.grid} style={{ '--cc-min': `${minCardWidth}px` } as CSSProperties}>\n <ChoiceCardGroupContext.Provider value={ctx}>\n {options\n ? options.map((option) => (\n <ChoiceCard\n key={option.value}\n value={option.value}\n label={option.label}\n description={option.description}\n icon={option.icon}\n disabled={option.disabled}\n />\n ))\n : children}\n </ChoiceCardGroupContext.Provider>\n </div>\n </div>\n )\n },\n)\n"],"names":["ChoiceCardGroupContext","createContext","useChoiceCardGroupContext","useContext","ICON_NAME_SET","ICON_NAMES","ChoiceCard","forwardRef","value","label","description","icon","align","color","size","error","checked","onChange","name","disabled","className","style","props","ref","group","resolvedColor","resolvedSize","resolvedError","resolvedDisabled","resolvedName","resolvedAlign","internal","setInternal","useState","isChecked","handleChange","event","iconNode","jsx","Icon","jsxs","clsx","styles","ChoiceCardGroup","exclusive","defaultValue","options","minCardWidth","required","children","reactId","useId","form","useFormContext","isFormBound","bound","externalValue","isControlled","current","ctx","v","next","arr","x","Typography","option"],"mappings":";;;;;;AAqBO,MAAMA,IAAyBC,EAAkD,IAAI;AAGrF,SAASC,IAAgE;AAC9E,SAAOC,EAAWH,CAAsB;AAC1C;;;;;;;;;;;;;;;;;;;;;GCXMI,KAAgB,IAAI,IAAYC,CAAU,GA4CnCC,KAAaC,EAA8C,SACtE;AAAA,EACE,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAQtB,EAAA,GAERuB,IAAgBZ,MAASW,KAAA,gBAAAA,EAAO,UAAS,WACzCE,IAAeZ,MAAQU,KAAA,gBAAAA,EAAO,SAAQ,MACtCG,IAAgBZ,MAASS,KAAA,gBAAAA,EAAO,UAAS,IACzCI,IAAmBT,MAAYK,KAAA,gBAAAA,EAAO,aAAY,IAClDK,IAAeX,MAAQM,KAAA,gBAAAA,EAAO,OAE9BM,IAAgBlB,MAASY,KAAA,gBAAAA,EAAO,WAAUb,KAAQ,OAAO,S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QAAA,EAAK,WAAWN,EAAO,UAAU,eAAY,QAAO,UAAA,IAAA,CAErD;AAAA,UAAA,GAEJ;AAAA,UAGF,gBAAAJ,EAAC,SAAI,WAAWI,EAAO,MAAM,OAAO,EAAE,YAAY,GAAGK,CAAY,KAAA,GAC/D,UAAA,gBAAAT,EAACtC,EAAuB,UAAvB,EAAgC,OAAO2D,GACrC,UAAAb,IACGA,EAAQ,IAAI,CAACmB,MACX,gBAAA3B;AAAA,YAAChC;AAAA,YAAA;AAAA,cAEC,OAAO2D,EAAO;AAAA,cACd,OAAOA,EAAO;AAAA,cACd,aAAaA,EAAO;AAAA,cACpB,MAAMA,EAAO;AAAA,cACb,UAAUA,EAAO;AAAA,YAAA;AAAA,YALZA,EAAO;AAAA,UAAA,CAOf,IACDhB,EAAA,CACN,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
1
+ {"version":3,"file":"ChoiceCardGroup-BBqUbFLS.js","sources":["../src/components/ChoiceCard/choiceCardContext.ts","../src/components/ChoiceCard/ChoiceCard.tsx","../src/components/ChoiceCard/ChoiceCardGroup.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { ThemeColor } from '../../theme'\nimport type { ChoiceCardAlign, ChoiceCardSize } from './ChoiceCard'\n\n/** Shared state a `<ChoiceCardGroup>` hands down to its `<ChoiceCard>` children via context. */\nexport interface ChoiceCardGroupContextValue {\n /** Shared input `name` — in `exclusive` mode the cards are native radios and must share one. */\n name?: string\n /** Single-selection (radio semantics) vs multiple (checkbox semantics). */\n exclusive: boolean\n /** Whether a card's value is currently selected. */\n isSelected: (value: string) => boolean\n /** Select / toggle a value — called by a child `<ChoiceCard>` on change. */\n toggle: (value: string) => void\n size?: ChoiceCardSize\n align?: ChoiceCardAlign\n color?: ThemeColor\n disabled?: boolean\n error?: boolean\n}\n\nexport const ChoiceCardGroupContext = createContext<ChoiceCardGroupContextValue | null>(null)\n\n/** Read the surrounding `<ChoiceCardGroup>` so a `<ChoiceCard>` can wire itself in (or `null` when standalone). */\nexport function useChoiceCardGroupContext(): ChoiceCardGroupContextValue | null {\n return useContext(ChoiceCardGroupContext)\n}\n","import {\n forwardRef,\n useState,\n type ChangeEvent,\n type CSSProperties,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport type { ThemeColor } from '../../theme'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { useChoiceCardGroupContext } from './choiceCardContext'\nimport styles from './ChoiceCard.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type ChoiceCardSize = 'sm' | 'md' | 'lg'\nexport type ChoiceCardAlign = 'left' | 'center'\n\nexport interface ChoiceCardProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'color' | 'type' | 'onChange' | 'value'\n> {\n /** This card's value — selected when the surrounding `ChoiceCardGroup`'s value holds it. */\n value: string\n /** Card title. */\n label?: ReactNode\n /** Muted description line under the title. */\n description?: ReactNode\n /** Leading icon in a tinted circle — a known `IconName` or any node. Optional. */\n icon?: IconName | ReactNode\n /**\n * Content alignment. `center` centers the icon + text stack; `left` anchors the same stack to the\n * left edge (icon above left-aligned text). Defaults to the group's `align`, else `center` with an\n * icon and `left` without one.\n */\n align?: ChoiceCardAlign\n /** Theme palette token for the selected tint. Defaults to `primary` (inherits the group's `color`). */\n color?: ThemeColor\n /** Preset size — padding, icon circle and fonts. Inherits the group's `size` when omitted. */\n size?: ChoiceCardSize\n /** Marks the card invalid — reddens the border + indicator. Inherits the group's `error`. */\n error?: boolean\n /** Controlled selected state for standalone use (inside a `ChoiceCardGroup` the group drives this). */\n checked?: boolean\n /** Fires with the next selected state (standalone use). */\n onChange?: (checked: boolean) => void\n}\n\n/**\n * A selectable card — a rich checkbox/radio with an icon, title and description. The native input is\n * visually hidden but fully accessible (Space toggles; in an `exclusive` group the cards are real\n * radios, so Arrow keys rove between them); the card shows the state with a `color` border + soft halo,\n * a top-right tick indicator, and an icon circle that fills with the color while selected. Designed to\n * live inside a `<ChoiceCardGroup>` (which supplies the selection, `exclusive` mode and\n * `size`/`color`/`disabled`/`error` via context), but also works standalone as a single fancy checkbox\n * (`checked` + `onChange`). Styling uses `--tz-*` tokens via the shared `--tz-btn-rgb` pattern.\n */\nexport const ChoiceCard = forwardRef<HTMLInputElement, ChoiceCardProps>(function ChoiceCard(\n {\n value,\n label,\n description,\n icon,\n align,\n color,\n size,\n error,\n checked,\n onChange,\n name,\n disabled,\n className,\n style,\n ...props\n },\n ref,\n) {\n const group = useChoiceCardGroupContext()\n\n const resolvedColor = color ?? group?.color ?? 'primary'\n const resolvedSize = size ?? group?.size ?? 'md'\n const resolvedError = error ?? group?.error ?? false\n const resolvedDisabled = disabled ?? group?.disabled ?? false\n const resolvedName = name ?? group?.name\n // explicit prop → group's align → smart default (an icon centers the card, no icon reads as a row)\n const resolvedAlign = align ?? group?.align ?? (icon == null ? 'left' : 'center')\n\n // In a group the selection comes from context; standalone it's controlled (`checked`) or local.\n const [internal, setInternal] = useState(false)\n const isChecked = group ? group.isSelected(value) : checked !== undefined ? checked : internal\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (resolvedDisabled) return\n if (group) {\n group.toggle(value)\n return\n }\n if (checked === undefined) setInternal(event.target.checked)\n onChange?.(event.target.checked)\n }\n\n const iconNode =\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} size={resolvedSize} />\n ) : (\n icon\n )\n\n return (\n <label\n className={clsx(\n styles.card,\n styles[resolvedSize],\n resolvedAlign === 'left' && styles.left,\n isChecked && styles.selected,\n resolvedError && styles.error,\n resolvedDisabled && styles.disabled,\n className,\n )}\n style={\n {\n '--tz-btn-rgb': `var(--tz-color-${resolvedColor}-rgb)`,\n '--tz-btn-on': `var(--tz-color-${resolvedColor}-contrast, #fff)`,\n ...style,\n } as CSSProperties\n }\n >\n <input\n ref={ref}\n type={group?.exclusive ? 'radio' : 'checkbox'}\n className={styles.input}\n name={resolvedName}\n value={value}\n checked={isChecked}\n onChange={handleChange}\n disabled={resolvedDisabled}\n aria-invalid={resolvedError || undefined}\n {...props}\n />\n {/* top-right selection indicator — radio-style ring + dot in exclusive groups (mirrors Radio),\n else a circle that fills with the theme color + a CSS tick (checkbox semantics) */}\n <span\n className={clsx(styles.indicator, group?.exclusive && styles.radioDot)}\n aria-hidden=\"true\"\n />\n {icon != null && (\n <span className={styles.iconBox} aria-hidden=\"true\">\n {iconNode}\n </span>\n )}\n {(label != null || description != null) && (\n <span className={styles.text}>\n {label != null && <span className={styles.label}>{label}</span>}\n {description != null && <span className={styles.description}>{description}</span>}\n </span>\n )}\n </label>\n )\n})\n","import {\n forwardRef,\n useId,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport type { ThemeColor } from '../../theme'\nimport type { IconName } from '../../icons/names'\nimport { Typography } from '../Typography'\nimport { ChoiceCard, type ChoiceCardAlign, type ChoiceCardSize } from './ChoiceCard'\nimport { ChoiceCardGroupContext, type ChoiceCardGroupContextValue } from './choiceCardContext'\nimport styles from './ChoiceCard.module.css'\n\n/** A single card for the data-driven `options` prop. */\nexport interface ChoiceCardOption {\n value: string\n /** Card title. */\n label?: ReactNode\n /** Muted description line under the title. */\n description?: ReactNode\n /** Leading icon in a tinted circle — a known `IconName` or any node. */\n icon?: IconName | ReactNode\n disabled?: boolean\n}\n\nexport interface ChoiceCardGroupProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'color' | 'onChange' | 'defaultValue'\n> {\n /**\n * Single-selection (radio semantics — the cards are native radios, `value` is a `string | null`,\n * clicking the selected card keeps it selected) vs multiple (checkbox semantics — `value` is a\n * `string[]`). Defaults to `false` (multiple).\n */\n exclusive?: boolean\n /** Controlled value — a `string | null` when `exclusive`, else a `string[]`. */\n value?: string | string[] | null\n /** Initial value for uncontrolled use (same shape as `value`). */\n defaultValue?: string | string[] | null\n /** Fires with the next value (matches the `exclusive` shape). */\n onChange?: (value: string | string[] | null) => void\n /**\n * Input `name` — shared by the radios in `exclusive` mode, and the `<Form>` binding key (form value:\n * `string` when `exclusive`, else `string[]`). Auto-generated when omitted.\n */\n name?: string\n /** Data-driven cards — an alternative to passing `<ChoiceCard>` children. */\n options?: ChoiceCardOption[]\n /** Group label rendered above the cards. */\n label?: ReactNode\n /** Minimum card width in px — the grid fits as many per row as this allows. Defaults to `160`. */\n minCardWidth?: number\n /**\n * Content alignment for every card. `center` centers the icon + text stack; `left` anchors the same\n * stack to the left edge (icon above left-aligned text). Omit for the smart default — cards with an\n * icon center, icon-less cards left-align. A card's own `align` wins.\n */\n align?: ChoiceCardAlign\n /** Preset size for every card. Defaults to `md`. */\n size?: ChoiceCardSize\n /** Theme palette token for the selected tint. Defaults to `primary`. */\n color?: ThemeColor\n /** Marks the group invalid — reddens the card borders (no message text, like `RadioGroup`). */\n error?: boolean\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Disables every card in the group. */\n disabled?: boolean\n /** `<ChoiceCard>` children (used when `options` is not given). */\n children?: ReactNode\n}\n\n/**\n * A group of selectable cards — rich checkboxes/radios with icons, titles and descriptions (role\n * pickers, plan choices, permission sets). **`exclusive`** picks single-selection (radio semantics —\n * `value` is a `string | null` and Arrow keys rove between the cards) vs multiple (checkbox semantics —\n * `value` is a `string[]`); defaults to `false` (multiple). Controlled (`value` + `onChange`) or\n * uncontrolled (`defaultValue`); supply the cards via the data-driven `options` prop (`{ value, label,\n * description?, icon?, disabled? }[]`) or as `<ChoiceCard>` children. The cards lay out on a\n * **responsive grid** (`minCardWidth`, default `160` — as many per row as fit, wrapping below). Binds\n * to a surrounding `<Form>` by **`name`** — the form value is a `string` when `exclusive` (validate\n * with e.g. `z.string().min(1)`), else a `string[]` (`z.array(z.string()).min(1)`); the form's `error`\n * reddens the card borders (no message text, like `RadioGroup`). `role=\"radiogroup\"` / `\"group\"`;\n * styling uses `--tz-*` tokens via the shared `--tz-btn-rgb` pattern.\n */\nexport const ChoiceCardGroup = forwardRef<HTMLDivElement, ChoiceCardGroupProps>(\n function ChoiceCardGroup(\n {\n exclusive = false,\n value,\n defaultValue,\n onChange,\n name,\n options,\n label,\n minCardWidth = 160,\n align,\n size = 'md',\n color = 'primary',\n error,\n required = false,\n disabled = false,\n children,\n className,\n style,\n ...props\n },\n ref,\n ) {\n // exclusive cards are native radios — they need a shared input name even without a form\n const reactId = useId()\n const resolvedName = name ?? `choice-${reactId}`\n\n // Auto-bind to a surrounding <Form> by `name` — the form value mirrors the `exclusive` shape.\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue: string | string[] | null | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? (form!.values[name!] as string | string[] | null | undefined)\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<string | string[] | null | undefined>(defaultValue)\n const current = isControlled ? externalValue : internal\n\n const resolvedError = error ?? bound?.error ?? false\n\n const isSelected = (v: string) =>\n exclusive ? current === v : Array.isArray(current) && current.includes(v)\n\n const toggle = (v: string) => {\n let next: string | string[] | null\n if (exclusive) {\n next = v // radio semantics — selecting again keeps it selected\n } else {\n const arr = Array.isArray(current) ? current : []\n next = arr.includes(v) ? arr.filter((x) => x !== v) : [...arr, v]\n }\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n const ctx: ChoiceCardGroupContextValue = {\n name: resolvedName,\n exclusive,\n isSelected,\n toggle,\n size,\n align,\n color,\n disabled,\n error: resolvedError,\n }\n\n return (\n <div\n ref={ref}\n role={exclusive ? 'radiogroup' : 'group'}\n aria-invalid={resolvedError || undefined}\n className={clsx(styles.group, className)}\n style={style as CSSProperties}\n {...props}\n >\n {label != null && (\n <span className={styles.groupLabel}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n )}\n\n <div className={styles.grid} style={{ '--cc-min': `${minCardWidth}px` } as CSSProperties}>\n <ChoiceCardGroupContext.Provider value={ctx}>\n {options\n ? options.map((option) => (\n <ChoiceCard\n key={option.value}\n value={option.value}\n label={option.label}\n description={option.description}\n icon={option.icon}\n disabled={option.disabled}\n />\n ))\n : children}\n </ChoiceCardGroupContext.Provider>\n </div>\n </div>\n )\n },\n)\n"],"names":["ChoiceCardGroupContext","createContext","useChoiceCardGroupContext","useContext","ICON_NAME_SET","ICON_NAMES","ChoiceCard","forwardRef","value","label","description","icon","align","color","size","error","checked","onChange","name","disabled","className","style","props","ref","group","resolvedColor","resolvedSize","resolvedError","resolvedDisabled","resolvedName","resolvedAlign","internal","setInternal","useState","isChecked","handleChange","event","iconNode","jsx","Icon","jsxs","clsx","styles","ChoiceCardGroup","exclusive","defaultValue","options","minCardWidth","required","children","reactId","useId","form","useFormContext","isFormBound","bound","externalValue","isControlled","current","ctx","v","next","arr","x","Typography","option"],"mappings":";;;;;;AAqBO,MAAMA,IAAyBC,EAAkD,IAAI;AAGrF,SAASC,IAAgE;AAC9E,SAAOC,EAAWH,CAAsB;AAC1C;;;;;;;;;;;;;;;;;;;;;GCXMI,KAAgB,IAAI,IAAYC,CAAU,GA4CnCC,KAAaC,EAA8C,SACtE;AAAA,EACE,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAQtB,EAAA,GAERuB,IAAgBZ,MAASW,KAAA,gBAAAA,EAAO,UAAS,WAC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tB,CAAS;AAAA,QACvC,OAAAC;AAAA,QACC,GAAGC;AAAA,QAEH,UAAA;AAAA,UAAAb,KAAS,QACR,gBAAA+B,EAAC,QAAA,EAAK,WAAWE,EAAO,YACtB,UAAA;AAAA,YAAA,gBAAAJ,EAAC0B,KAAW,IAAG,QAAO,SAAQ,aAAY,OAAM,SAC7C,UAAAvD,EAAA,CACH;AAAA,YACCuC,uBACE,QAAA,EAAK,WAAWN,EAAO,UAAU,eAAY,QAAO,UAAA,IAAA,CAErD;AAAA,UAAA,GAEJ;AAAA,UAGF,gBAAAJ,EAAC,SAAI,WAAWI,EAAO,MAAM,OAAO,EAAE,YAAY,GAAGK,CAAY,KAAA,GAC/D,UAAA,gBAAAT,EAACtC,EAAuB,UAAvB,EAAgC,OAAO2D,GACrC,UAAAb,IACGA,EAAQ,IAAI,CAACmB,MACX,gBAAA3B;AAAA,YAAChC;AAAA,YAAA;AAAA,cAEC,OAAO2D,EAAO;AAAA,cACd,OAAOA,EAAO;AAAA,cACd,aAAaA,EAAO;AAAA,cACpB,MAAMA,EAAO;AAAA,cACb,UAAUA,EAAO;AAAA,YAAA;AAAA,YALZA,EAAO;AAAA,UAAA,CAOf,IACDhB,EAAA,CACN,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
@@ -1,2 +1,2 @@
1
- "use strict";const t=require("react/jsx-runtime"),i=require("react"),$=require("clsx"),V=require("./formContext-bTWrqdEV.cjs"),P=require("./Typography-d97DdbNd.cjs"),w=require("./Icon-CBg21lKA.cjs"),R=i.createContext(null);function H(){return i.useContext(R)}const J="_group_7s2td_2",K="_groupLabel_7s2td_8",Q="_required_7s2td_13",U="_grid_7s2td_17",W="_card_7s2td_24",X="_disabled_7s2td_43",Y="_selected_7s2td_43",Z="_input_7s2td_53",ee="_error_7s2td_57",se="_left_7s2td_69",te="_text_7s2td_73",re="_sm_7s2td_79",oe="_md_7s2td_87",ce="_lg_7s2td_95",de="_indicator_7s2td_119",le="_radioDot_7s2td_164",ne="_iconBox_7s2td_187",ie="_label_7s2td_214",ae="_description_7s2td_221",s={group:J,groupLabel:K,required:Q,grid:U,card:W,disabled:X,selected:Y,input:Z,error:ee,left:se,text:te,sm:re,md:oe,lg:ce,indicator:de,radioDot:le,iconBox:ne,label:ie,description:ae},_e=new Set(w.ICON_NAMES),T=i.forwardRef(function({value:c,label:a,description:_,icon:o,align:d,color:p,size:C,error:q,checked:u,onChange:x,name:S,disabled:I,className:z,style:A,...B},D){const e=H(),v=p??(e==null?void 0:e.color)??"primary",N=C??(e==null?void 0:e.size)??"md",j=q??(e==null?void 0:e.error)??!1,f=I??(e==null?void 0:e.disabled)??!1,n=S??(e==null?void 0:e.name),y=d??(e==null?void 0:e.align)??(o==null?"left":"center"),[m,g]=i.useState(!1),h=e?e.isSelected(c):u!==void 0?u:m,E=l=>{if(!f){if(e){e.toggle(c);return}u===void 0&&g(l.target.checked),x==null||x(l.target.checked)}},G=typeof o=="string"&&_e.has(o)?t.jsx(w.Icon,{name:o,size:N}):o;return t.jsxs("label",{className:$.clsx(s.card,s[N],y==="left"&&s.left,h&&s.selected,j&&s.error,f&&s.disabled,z),style:{"--tz-btn-rgb":`var(--tz-color-${v}-rgb)`,"--tz-btn-on":`var(--tz-color-${v}-contrast, #fff)`,...A},children:[t.jsx("input",{ref:D,type:e!=null&&e.exclusive?"radio":"checkbox",className:s.input,name:n,value:c,checked:h,onChange:E,disabled:f,"aria-invalid":j||void 0,...B}),t.jsx("span",{className:$.clsx(s.indicator,(e==null?void 0:e.exclusive)&&s.radioDot),"aria-hidden":"true"}),o!=null&&t.jsx("span",{className:s.iconBox,"aria-hidden":"true",children:G}),(a!=null||_!=null)&&t.jsxs("span",{className:s.text,children:[a!=null&&t.jsx("span",{className:s.label,children:a}),_!=null&&t.jsx("span",{className:s.description,children:_})]})]})}),ue=i.forwardRef(function({exclusive:c=!1,value:a,defaultValue:_,onChange:o,name:d,options:p,label:C,minCardWidth:q=160,align:u,size:x="md",color:S="primary",error:I,required:z=!1,disabled:A=!1,children:B,className:D,style:e,...v},N){const j=i.useId(),f=d??`choice-${j}`,n=V.useFormContext(),y=!!(n&&d),m=n&&d?n.field(d):void 0,g=a!==void 0?a:y?n.values[d]:void 0,h=g!==void 0,[E,G]=i.useState(_),l=h?g:E,k=I??(m==null?void 0:m.error)??!1,M={name:f,exclusive:c,isSelected:r=>c?l===r:Array.isArray(l)&&l.includes(r),toggle:r=>{let b;if(c)b=r;else{const L=Array.isArray(l)?l:[];b=L.includes(r)?L.filter(O=>O!==r):[...L,r]}h||G(b),y&&n.setValue(d,b),o==null||o(b)},size:x,align:u,color:S,disabled:A,error:k};return t.jsxs("div",{ref:N,role:c?"radiogroup":"group","aria-invalid":k||void 0,className:$.clsx(s.group,D),style:e,...v,children:[C!=null&&t.jsxs("span",{className:s.groupLabel,children:[t.jsx(P.Typography,{as:"span",variant:"bodySmall",color:"muted",children:C}),z&&t.jsx("span",{className:s.required,"aria-hidden":"true",children:"*"})]}),t.jsx("div",{className:s.grid,style:{"--cc-min":`${q}px`},children:t.jsx(R.Provider,{value:M,children:p?p.map(r=>t.jsx(T,{value:r.value,label:r.label,description:r.description,icon:r.icon,disabled:r.disabled},r.value)):B})})]})});exports.ChoiceCard=T;exports.ChoiceCardGroup=ue;
2
- //# sourceMappingURL=ChoiceCardGroup-Cj_YFj6C.cjs.map
1
+ "use strict";const t=require("react/jsx-runtime"),i=require("react"),$=require("clsx"),V=require("./formContext-bTWrqdEV.cjs"),P=require("./Typography-d97DdbNd.cjs"),w=require("./Icon-BoQmbW7j.cjs"),R=i.createContext(null);function H(){return i.useContext(R)}const J="_group_7s2td_2",K="_groupLabel_7s2td_8",Q="_required_7s2td_13",U="_grid_7s2td_17",W="_card_7s2td_24",X="_disabled_7s2td_43",Y="_selected_7s2td_43",Z="_input_7s2td_53",ee="_error_7s2td_57",se="_left_7s2td_69",te="_text_7s2td_73",re="_sm_7s2td_79",oe="_md_7s2td_87",ce="_lg_7s2td_95",de="_indicator_7s2td_119",le="_radioDot_7s2td_164",ne="_iconBox_7s2td_187",ie="_label_7s2td_214",ae="_description_7s2td_221",s={group:J,groupLabel:K,required:Q,grid:U,card:W,disabled:X,selected:Y,input:Z,error:ee,left:se,text:te,sm:re,md:oe,lg:ce,indicator:de,radioDot:le,iconBox:ne,label:ie,description:ae},_e=new Set(w.ICON_NAMES),T=i.forwardRef(function({value:c,label:a,description:_,icon:o,align:d,color:p,size:C,error:q,checked:u,onChange:x,name:S,disabled:I,className:z,style:A,...B},D){const e=H(),v=p??(e==null?void 0:e.color)??"primary",N=C??(e==null?void 0:e.size)??"md",j=q??(e==null?void 0:e.error)??!1,f=I??(e==null?void 0:e.disabled)??!1,n=S??(e==null?void 0:e.name),y=d??(e==null?void 0:e.align)??(o==null?"left":"center"),[m,g]=i.useState(!1),h=e?e.isSelected(c):u!==void 0?u:m,E=l=>{if(!f){if(e){e.toggle(c);return}u===void 0&&g(l.target.checked),x==null||x(l.target.checked)}},G=typeof o=="string"&&_e.has(o)?t.jsx(w.Icon,{name:o,size:N}):o;return t.jsxs("label",{className:$.clsx(s.card,s[N],y==="left"&&s.left,h&&s.selected,j&&s.error,f&&s.disabled,z),style:{"--tz-btn-rgb":`var(--tz-color-${v}-rgb)`,"--tz-btn-on":`var(--tz-color-${v}-contrast, #fff)`,...A},children:[t.jsx("input",{ref:D,type:e!=null&&e.exclusive?"radio":"checkbox",className:s.input,name:n,value:c,checked:h,onChange:E,disabled:f,"aria-invalid":j||void 0,...B}),t.jsx("span",{className:$.clsx(s.indicator,(e==null?void 0:e.exclusive)&&s.radioDot),"aria-hidden":"true"}),o!=null&&t.jsx("span",{className:s.iconBox,"aria-hidden":"true",children:G}),(a!=null||_!=null)&&t.jsxs("span",{className:s.text,children:[a!=null&&t.jsx("span",{className:s.label,children:a}),_!=null&&t.jsx("span",{className:s.description,children:_})]})]})}),ue=i.forwardRef(function({exclusive:c=!1,value:a,defaultValue:_,onChange:o,name:d,options:p,label:C,minCardWidth:q=160,align:u,size:x="md",color:S="primary",error:I,required:z=!1,disabled:A=!1,children:B,className:D,style:e,...v},N){const j=i.useId(),f=d??`choice-${j}`,n=V.useFormContext(),y=!!(n&&d),m=n&&d?n.field(d):void 0,g=a!==void 0?a:y?n.values[d]:void 0,h=g!==void 0,[E,G]=i.useState(_),l=h?g:E,k=I??(m==null?void 0:m.error)??!1,M={name:f,exclusive:c,isSelected:r=>c?l===r:Array.isArray(l)&&l.includes(r),toggle:r=>{let b;if(c)b=r;else{const L=Array.isArray(l)?l:[];b=L.includes(r)?L.filter(O=>O!==r):[...L,r]}h||G(b),y&&n.setValue(d,b),o==null||o(b)},size:x,align:u,color:S,disabled:A,error:k};return t.jsxs("div",{ref:N,role:c?"radiogroup":"group","aria-invalid":k||void 0,className:$.clsx(s.group,D),style:e,...v,children:[C!=null&&t.jsxs("span",{className:s.groupLabel,children:[t.jsx(P.Typography,{as:"span",variant:"bodySmall",color:"muted",children:C}),z&&t.jsx("span",{className:s.required,"aria-hidden":"true",children:"*"})]}),t.jsx("div",{className:s.grid,style:{"--cc-min":`${q}px`},children:t.jsx(R.Provider,{value:M,children:p?p.map(r=>t.jsx(T,{value:r.value,label:r.label,description:r.description,icon:r.icon,disabled:r.disabled},r.value)):B})})]})});exports.ChoiceCard=T;exports.ChoiceCardGroup=ue;
2
+ //# sourceMappingURL=ChoiceCardGroup-bnKFPDYz.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceCardGroup-Cj_YFj6C.cjs","sources":["../src/components/ChoiceCard/choiceCardContext.ts","../src/components/ChoiceCard/ChoiceCard.tsx","../src/components/ChoiceCard/ChoiceCardGroup.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { ThemeColor } from '../../theme'\nimport type { ChoiceCardAlign, ChoiceCardSize } from './ChoiceCard'\n\n/** Shared state a `<ChoiceCardGroup>` hands down to its `<ChoiceCard>` children via context. */\nexport interface ChoiceCardGroupContextValue {\n /** Shared input `name` — in `exclusive` mode the cards are native radios and must share one. */\n name?: string\n /** Single-selection (radio semantics) vs multiple (checkbox semantics). */\n exclusive: boolean\n /** Whether a card's value is currently selected. */\n isSelected: (value: string) => boolean\n /** Select / toggle a value — called by a child `<ChoiceCard>` on change. */\n toggle: (value: string) => void\n size?: ChoiceCardSize\n align?: ChoiceCardAlign\n color?: ThemeColor\n disabled?: boolean\n error?: boolean\n}\n\nexport const ChoiceCardGroupContext = createContext<ChoiceCardGroupContextValue | null>(null)\n\n/** Read the surrounding `<ChoiceCardGroup>` so a `<ChoiceCard>` can wire itself in (or `null` when standalone). */\nexport function useChoiceCardGroupContext(): ChoiceCardGroupContextValue | null {\n return useContext(ChoiceCardGroupContext)\n}\n","import {\n forwardRef,\n useState,\n type ChangeEvent,\n type CSSProperties,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport type { ThemeColor } from '../../theme'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { useChoiceCardGroupContext } from './choiceCardContext'\nimport styles from './ChoiceCard.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type ChoiceCardSize = 'sm' | 'md' | 'lg'\nexport type ChoiceCardAlign = 'left' | 'center'\n\nexport interface ChoiceCardProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'color' | 'type' | 'onChange' | 'value'\n> {\n /** This card's value — selected when the surrounding `ChoiceCardGroup`'s value holds it. */\n value: string\n /** Card title. */\n label?: ReactNode\n /** Muted description line under the title. */\n description?: ReactNode\n /** Leading icon in a tinted circle — a known `IconName` or any node. Optional. */\n icon?: IconName | ReactNode\n /**\n * Content alignment. `center` centers the icon + text stack; `left` anchors the same stack to the\n * left edge (icon above left-aligned text). Defaults to the group's `align`, else `center` with an\n * icon and `left` without one.\n */\n align?: ChoiceCardAlign\n /** Theme palette token for the selected tint. Defaults to `primary` (inherits the group's `color`). */\n color?: ThemeColor\n /** Preset size — padding, icon circle and fonts. Inherits the group's `size` when omitted. */\n size?: ChoiceCardSize\n /** Marks the card invalid — reddens the border + indicator. Inherits the group's `error`. */\n error?: boolean\n /** Controlled selected state for standalone use (inside a `ChoiceCardGroup` the group drives this). */\n checked?: boolean\n /** Fires with the next selected state (standalone use). */\n onChange?: (checked: boolean) => void\n}\n\n/**\n * A selectable card — a rich checkbox/radio with an icon, title and description. The native input is\n * visually hidden but fully accessible (Space toggles; in an `exclusive` group the cards are real\n * radios, so Arrow keys rove between them); the card shows the state with a `color` border + soft halo,\n * a top-right tick indicator, and an icon circle that fills with the color while selected. Designed to\n * live inside a `<ChoiceCardGroup>` (which supplies the selection, `exclusive` mode and\n * `size`/`color`/`disabled`/`error` via context), but also works standalone as a single fancy checkbox\n * (`checked` + `onChange`). Styling uses `--tz-*` tokens via the shared `--tz-btn-rgb` pattern.\n */\nexport const ChoiceCard = forwardRef<HTMLInputElement, ChoiceCardProps>(function ChoiceCard(\n {\n value,\n label,\n description,\n icon,\n align,\n color,\n size,\n error,\n checked,\n onChange,\n name,\n disabled,\n className,\n style,\n ...props\n },\n ref,\n) {\n const group = useChoiceCardGroupContext()\n\n const resolvedColor = color ?? group?.color ?? 'primary'\n const resolvedSize = size ?? group?.size ?? 'md'\n const resolvedError = error ?? group?.error ?? false\n const resolvedDisabled = disabled ?? group?.disabled ?? false\n const resolvedName = name ?? group?.name\n // explicit prop → group's align → smart default (an icon centers the card, no icon reads as a row)\n const resolvedAlign = align ?? group?.align ?? (icon == null ? 'left' : 'center')\n\n // In a group the selection comes from context; standalone it's controlled (`checked`) or local.\n const [internal, setInternal] = useState(false)\n const isChecked = group ? group.isSelected(value) : checked !== undefined ? checked : internal\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (resolvedDisabled) return\n if (group) {\n group.toggle(value)\n return\n }\n if (checked === undefined) setInternal(event.target.checked)\n onChange?.(event.target.checked)\n }\n\n const iconNode =\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} size={resolvedSize} />\n ) : (\n icon\n )\n\n return (\n <label\n className={clsx(\n styles.card,\n styles[resolvedSize],\n resolvedAlign === 'left' && styles.left,\n isChecked && styles.selected,\n resolvedError && styles.error,\n resolvedDisabled && styles.disabled,\n className,\n )}\n style={\n {\n '--tz-btn-rgb': `var(--tz-color-${resolvedColor}-rgb)`,\n '--tz-btn-on': `var(--tz-color-${resolvedColor}-contrast, #fff)`,\n ...style,\n } as CSSProperties\n }\n >\n <input\n ref={ref}\n type={group?.exclusive ? 'radio' : 'checkbox'}\n className={styles.input}\n name={resolvedName}\n value={value}\n checked={isChecked}\n onChange={handleChange}\n disabled={resolvedDisabled}\n aria-invalid={resolvedError || undefined}\n {...props}\n />\n {/* top-right selection indicator — radio-style ring + dot in exclusive groups (mirrors Radio),\n else a circle that fills with the theme color + a CSS tick (checkbox semantics) */}\n <span\n className={clsx(styles.indicator, group?.exclusive && styles.radioDot)}\n aria-hidden=\"true\"\n />\n {icon != null && (\n <span className={styles.iconBox} aria-hidden=\"true\">\n {iconNode}\n </span>\n )}\n {(label != null || description != null) && (\n <span className={styles.text}>\n {label != null && <span className={styles.label}>{label}</span>}\n {description != null && <span className={styles.description}>{description}</span>}\n </span>\n )}\n </label>\n )\n})\n","import {\n forwardRef,\n useId,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport type { ThemeColor } from '../../theme'\nimport type { IconName } from '../../icons/names'\nimport { Typography } from '../Typography'\nimport { ChoiceCard, type ChoiceCardAlign, type ChoiceCardSize } from './ChoiceCard'\nimport { ChoiceCardGroupContext, type ChoiceCardGroupContextValue } from './choiceCardContext'\nimport styles from './ChoiceCard.module.css'\n\n/** A single card for the data-driven `options` prop. */\nexport interface ChoiceCardOption {\n value: string\n /** Card title. */\n label?: ReactNode\n /** Muted description line under the title. */\n description?: ReactNode\n /** Leading icon in a tinted circle — a known `IconName` or any node. */\n icon?: IconName | ReactNode\n disabled?: boolean\n}\n\nexport interface ChoiceCardGroupProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'color' | 'onChange' | 'defaultValue'\n> {\n /**\n * Single-selection (radio semantics — the cards are native radios, `value` is a `string | null`,\n * clicking the selected card keeps it selected) vs multiple (checkbox semantics — `value` is a\n * `string[]`). Defaults to `false` (multiple).\n */\n exclusive?: boolean\n /** Controlled value — a `string | null` when `exclusive`, else a `string[]`. */\n value?: string | string[] | null\n /** Initial value for uncontrolled use (same shape as `value`). */\n defaultValue?: string | string[] | null\n /** Fires with the next value (matches the `exclusive` shape). */\n onChange?: (value: string | string[] | null) => void\n /**\n * Input `name` — shared by the radios in `exclusive` mode, and the `<Form>` binding key (form value:\n * `string` when `exclusive`, else `string[]`). Auto-generated when omitted.\n */\n name?: string\n /** Data-driven cards — an alternative to passing `<ChoiceCard>` children. */\n options?: ChoiceCardOption[]\n /** Group label rendered above the cards. */\n label?: ReactNode\n /** Minimum card width in px — the grid fits as many per row as this allows. Defaults to `160`. */\n minCardWidth?: number\n /**\n * Content alignment for every card. `center` centers the icon + text stack; `left` anchors the same\n * stack to the left edge (icon above left-aligned text). Omit for the smart default — cards with an\n * icon center, icon-less cards left-align. A card's own `align` wins.\n */\n align?: ChoiceCardAlign\n /** Preset size for every card. Defaults to `md`. */\n size?: ChoiceCardSize\n /** Theme palette token for the selected tint. Defaults to `primary`. */\n color?: ThemeColor\n /** Marks the group invalid — reddens the card borders (no message text, like `RadioGroup`). */\n error?: boolean\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Disables every card in the group. */\n disabled?: boolean\n /** `<ChoiceCard>` children (used when `options` is not given). */\n children?: ReactNode\n}\n\n/**\n * A group of selectable cards — rich checkboxes/radios with icons, titles and descriptions (role\n * pickers, plan choices, permission sets). **`exclusive`** picks single-selection (radio semantics —\n * `value` is a `string | null` and Arrow keys rove between the cards) vs multiple (checkbox semantics —\n * `value` is a `string[]`); defaults to `false` (multiple). Controlled (`value` + `onChange`) or\n * uncontrolled (`defaultValue`); supply the cards via the data-driven `options` prop (`{ value, label,\n * description?, icon?, disabled? }[]`) or as `<ChoiceCard>` children. The cards lay out on a\n * **responsive grid** (`minCardWidth`, default `160` — as many per row as fit, wrapping below). Binds\n * to a surrounding `<Form>` by **`name`** — the form value is a `string` when `exclusive` (validate\n * with e.g. `z.string().min(1)`), else a `string[]` (`z.array(z.string()).min(1)`); the form's `error`\n * reddens the card borders (no message text, like `RadioGroup`). `role=\"radiogroup\"` / `\"group\"`;\n * styling uses `--tz-*` tokens via the shared `--tz-btn-rgb` pattern.\n */\nexport const ChoiceCardGroup = forwardRef<HTMLDivElement, ChoiceCardGroupProps>(\n function ChoiceCardGroup(\n {\n exclusive = false,\n value,\n defaultValue,\n onChange,\n name,\n options,\n label,\n minCardWidth = 160,\n align,\n size = 'md',\n color = 'primary',\n error,\n required = false,\n disabled = false,\n children,\n className,\n style,\n ...props\n },\n ref,\n ) {\n // exclusive cards are native radios — they need a shared input name even without a form\n const reactId = useId()\n const resolvedName = name ?? `choice-${reactId}`\n\n // Auto-bind to a surrounding <Form> by `name` — the form value mirrors the `exclusive` shape.\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue: string | string[] | null | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? (form!.values[name!] as string | string[] | null | undefined)\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<string | string[] | null | undefined>(defaultValue)\n const current = isControlled ? externalValue : internal\n\n const resolvedError = error ?? bound?.error ?? false\n\n const isSelected = (v: string) =>\n exclusive ? current === v : Array.isArray(current) && current.includes(v)\n\n const toggle = (v: string) => {\n let next: string | string[] | null\n if (exclusive) {\n next = v // radio semantics — selecting again keeps it selected\n } else {\n const arr = Array.isArray(current) ? current : []\n next = arr.includes(v) ? arr.filter((x) => x !== v) : [...arr, v]\n }\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n const ctx: ChoiceCardGroupContextValue = {\n name: resolvedName,\n exclusive,\n isSelected,\n toggle,\n size,\n align,\n color,\n disabled,\n error: resolvedError,\n }\n\n return (\n <div\n ref={ref}\n role={exclusive ? 'radiogroup' : 'group'}\n aria-invalid={resolvedError || undefined}\n className={clsx(styles.group, className)}\n style={style as CSSProperties}\n {...props}\n >\n {label != null && (\n <span className={styles.groupLabel}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n )}\n\n <div className={styles.grid} style={{ '--cc-min': `${minCardWidth}px` } as CSSProperties}>\n <ChoiceCardGroupContext.Provider value={ctx}>\n {options\n ? options.map((option) => (\n <ChoiceCard\n key={option.value}\n value={option.value}\n label={option.label}\n description={option.description}\n icon={option.icon}\n disabled={option.disabled}\n />\n ))\n : children}\n </ChoiceCardGroupContext.Provider>\n </div>\n </div>\n )\n },\n)\n"],"names":["ChoiceCardGroupContext","createContext","useChoiceCardGroupContext","useContext","ICON_NAME_SET","ICON_NAMES","ChoiceCard","forwardRef","value","label","description","icon","align","color","size","error","checked","onChange","name","disabled","className","style","props","ref","group","resolvedColor","resolvedSize","resolvedError","resolvedDisabled","resolvedName","resolvedAlign","internal","setInternal","useState","isChecked","handleChange","event","iconNode","jsx","Icon","jsxs","clsx","styles","ChoiceCardGroup","exclusive","defaultValue","options","minCardWidth","required","children","reactId","useId","form","useFormContext","isFormBound","bound","externalValue","isControlled","current","ctx","v","next","arr","x","Typography","option"],"mappings":"uMAqBaA,EAAyBC,EAAAA,cAAkD,IAAI,EAGrF,SAASC,GAAgE,CAC9E,OAAOC,EAAAA,WAAWH,CAAsB,CAC1C,wlBCXMI,GAAgB,IAAI,IAAYC,YAAU,EA4CnCC,EAAaC,EAAAA,WAA8C,SACtE,CACE,MAAAC,EACA,MAAAC,EACA,YAAAC,EACA,KAAAC,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OAAI,UAAWI,EAAO,KAAM,MAAO,CAAE,WAAY,GAAGK,CAAY,IAAA,EAC/D,SAAAT,EAAAA,IAACtC,EAAuB,SAAvB,CAAgC,MAAO2D,EACrC,SAAAb,EACGA,EAAQ,IAAKmB,GACX3B,EAAAA,IAAChC,EAAA,CAEC,MAAO2D,EAAO,MACd,MAAOA,EAAO,MACd,YAAaA,EAAO,YACpB,KAAMA,EAAO,KACb,SAAUA,EAAO,QAAA,EALZA,EAAO,KAAA,CAOf,EACDhB,CAAA,CACN,CAAA,CACF,CAAA,CAAA,CAAA,CAGN,CACF"}
1
+ {"version":3,"file":"ChoiceCardGroup-bnKFPDYz.cjs","sources":["../src/components/ChoiceCard/choiceCardContext.ts","../src/components/ChoiceCard/ChoiceCard.tsx","../src/components/ChoiceCard/ChoiceCardGroup.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { ThemeColor } from '../../theme'\nimport type { ChoiceCardAlign, ChoiceCardSize } from './ChoiceCard'\n\n/** Shared state a `<ChoiceCardGroup>` hands down to its `<ChoiceCard>` children via context. */\nexport interface ChoiceCardGroupContextValue {\n /** Shared input `name` — in `exclusive` mode the cards are native radios and must share one. */\n name?: string\n /** Single-selection (radio semantics) vs multiple (checkbox semantics). */\n exclusive: boolean\n /** Whether a card's value is currently selected. */\n isSelected: (value: string) => boolean\n /** Select / toggle a value — called by a child `<ChoiceCard>` on change. */\n toggle: (value: string) => void\n size?: ChoiceCardSize\n align?: ChoiceCardAlign\n color?: ThemeColor\n disabled?: boolean\n error?: boolean\n}\n\nexport const ChoiceCardGroupContext = createContext<ChoiceCardGroupContextValue | null>(null)\n\n/** Read the surrounding `<ChoiceCardGroup>` so a `<ChoiceCard>` can wire itself in (or `null` when standalone). */\nexport function useChoiceCardGroupContext(): ChoiceCardGroupContextValue | null {\n return useContext(ChoiceCardGroupContext)\n}\n","import {\n forwardRef,\n useState,\n type ChangeEvent,\n type CSSProperties,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport type { ThemeColor } from '../../theme'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { useChoiceCardGroupContext } from './choiceCardContext'\nimport styles from './ChoiceCard.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type ChoiceCardSize = 'sm' | 'md' | 'lg'\nexport type ChoiceCardAlign = 'left' | 'center'\n\nexport interface ChoiceCardProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'color' | 'type' | 'onChange' | 'value'\n> {\n /** This card's value — selected when the surrounding `ChoiceCardGroup`'s value holds it. */\n value: string\n /** Card title. */\n label?: ReactNode\n /** Muted description line under the title. */\n description?: ReactNode\n /** Leading icon in a tinted circle — a known `IconName` or any node. Optional. */\n icon?: IconName | ReactNode\n /**\n * Content alignment. `center` centers the icon + text stack; `left` anchors the same stack to the\n * left edge (icon above left-aligned text). Defaults to the group's `align`, else `center` with an\n * icon and `left` without one.\n */\n align?: ChoiceCardAlign\n /** Theme palette token for the selected tint. Defaults to `primary` (inherits the group's `color`). */\n color?: ThemeColor\n /** Preset size — padding, icon circle and fonts. Inherits the group's `size` when omitted. */\n size?: ChoiceCardSize\n /** Marks the card invalid — reddens the border + indicator. Inherits the group's `error`. */\n error?: boolean\n /** Controlled selected state for standalone use (inside a `ChoiceCardGroup` the group drives this). */\n checked?: boolean\n /** Fires with the next selected state (standalone use). */\n onChange?: (checked: boolean) => void\n}\n\n/**\n * A selectable card — a rich checkbox/radio with an icon, title and description. The native input is\n * visually hidden but fully accessible (Space toggles; in an `exclusive` group the cards are real\n * radios, so Arrow keys rove between them); the card shows the state with a `color` border + soft halo,\n * a top-right tick indicator, and an icon circle that fills with the color while selected. Designed to\n * live inside a `<ChoiceCardGroup>` (which supplies the selection, `exclusive` mode and\n * `size`/`color`/`disabled`/`error` via context), but also works standalone as a single fancy checkbox\n * (`checked` + `onChange`). Styling uses `--tz-*` tokens via the shared `--tz-btn-rgb` pattern.\n */\nexport const ChoiceCard = forwardRef<HTMLInputElement, ChoiceCardProps>(function ChoiceCard(\n {\n value,\n label,\n description,\n icon,\n align,\n color,\n size,\n error,\n checked,\n onChange,\n name,\n disabled,\n className,\n style,\n ...props\n },\n ref,\n) {\n const group = useChoiceCardGroupContext()\n\n const resolvedColor = color ?? group?.color ?? 'primary'\n const resolvedSize = size ?? group?.size ?? 'md'\n const resolvedError = error ?? group?.error ?? false\n const resolvedDisabled = disabled ?? group?.disabled ?? false\n const resolvedName = name ?? group?.name\n // explicit prop → group's align → smart default (an icon centers the card, no icon reads as a row)\n const resolvedAlign = align ?? group?.align ?? (icon == null ? 'left' : 'center')\n\n // In a group the selection comes from context; standalone it's controlled (`checked`) or local.\n const [internal, setInternal] = useState(false)\n const isChecked = group ? group.isSelected(value) : checked !== undefined ? checked : internal\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n if (resolvedDisabled) return\n if (group) {\n group.toggle(value)\n return\n }\n if (checked === undefined) setInternal(event.target.checked)\n onChange?.(event.target.checked)\n }\n\n const iconNode =\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} size={resolvedSize} />\n ) : (\n icon\n )\n\n return (\n <label\n className={clsx(\n styles.card,\n styles[resolvedSize],\n resolvedAlign === 'left' && styles.left,\n isChecked && styles.selected,\n resolvedError && styles.error,\n resolvedDisabled && styles.disabled,\n className,\n )}\n style={\n {\n '--tz-btn-rgb': `var(--tz-color-${resolvedColor}-rgb)`,\n '--tz-btn-on': `var(--tz-color-${resolvedColor}-contrast, #fff)`,\n ...style,\n } as CSSProperties\n }\n >\n <input\n ref={ref}\n type={group?.exclusive ? 'radio' : 'checkbox'}\n className={styles.input}\n name={resolvedName}\n value={value}\n checked={isChecked}\n onChange={handleChange}\n disabled={resolvedDisabled}\n aria-invalid={resolvedError || undefined}\n {...props}\n />\n {/* top-right selection indicator — radio-style ring + dot in exclusive groups (mirrors Radio),\n else a circle that fills with the theme color + a CSS tick (checkbox semantics) */}\n <span\n className={clsx(styles.indicator, group?.exclusive && styles.radioDot)}\n aria-hidden=\"true\"\n />\n {icon != null && (\n <span className={styles.iconBox} aria-hidden=\"true\">\n {iconNode}\n </span>\n )}\n {(label != null || description != null) && (\n <span className={styles.text}>\n {label != null && <span className={styles.label}>{label}</span>}\n {description != null && <span className={styles.description}>{description}</span>}\n </span>\n )}\n </label>\n )\n})\n","import {\n forwardRef,\n useId,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport type { ThemeColor } from '../../theme'\nimport type { IconName } from '../../icons/names'\nimport { Typography } from '../Typography'\nimport { ChoiceCard, type ChoiceCardAlign, type ChoiceCardSize } from './ChoiceCard'\nimport { ChoiceCardGroupContext, type ChoiceCardGroupContextValue } from './choiceCardContext'\nimport styles from './ChoiceCard.module.css'\n\n/** A single card for the data-driven `options` prop. */\nexport interface ChoiceCardOption {\n value: string\n /** Card title. */\n label?: ReactNode\n /** Muted description line under the title. */\n description?: ReactNode\n /** Leading icon in a tinted circle — a known `IconName` or any node. */\n icon?: IconName | ReactNode\n disabled?: boolean\n}\n\nexport interface ChoiceCardGroupProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'color' | 'onChange' | 'defaultValue'\n> {\n /**\n * Single-selection (radio semantics — the cards are native radios, `value` is a `string | null`,\n * clicking the selected card keeps it selected) vs multiple (checkbox semantics — `value` is a\n * `string[]`). Defaults to `false` (multiple).\n */\n exclusive?: boolean\n /** Controlled value — a `string | null` when `exclusive`, else a `string[]`. */\n value?: string | string[] | null\n /** Initial value for uncontrolled use (same shape as `value`). */\n defaultValue?: string | string[] | null\n /** Fires with the next value (matches the `exclusive` shape). */\n onChange?: (value: string | string[] | null) => void\n /**\n * Input `name` — shared by the radios in `exclusive` mode, and the `<Form>` binding key (form value:\n * `string` when `exclusive`, else `string[]`). Auto-generated when omitted.\n */\n name?: string\n /** Data-driven cards — an alternative to passing `<ChoiceCard>` children. */\n options?: ChoiceCardOption[]\n /** Group label rendered above the cards. */\n label?: ReactNode\n /** Minimum card width in px — the grid fits as many per row as this allows. Defaults to `160`. */\n minCardWidth?: number\n /**\n * Content alignment for every card. `center` centers the icon + text stack; `left` anchors the same\n * stack to the left edge (icon above left-aligned text). Omit for the smart default — cards with an\n * icon center, icon-less cards left-align. A card's own `align` wins.\n */\n align?: ChoiceCardAlign\n /** Preset size for every card. Defaults to `md`. */\n size?: ChoiceCardSize\n /** Theme palette token for the selected tint. Defaults to `primary`. */\n color?: ThemeColor\n /** Marks the group invalid — reddens the card borders (no message text, like `RadioGroup`). */\n error?: boolean\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Disables every card in the group. */\n disabled?: boolean\n /** `<ChoiceCard>` children (used when `options` is not given). */\n children?: ReactNode\n}\n\n/**\n * A group of selectable cards — rich checkboxes/radios with icons, titles and descriptions (role\n * pickers, plan choices, permission sets). **`exclusive`** picks single-selection (radio semantics —\n * `value` is a `string | null` and Arrow keys rove between the cards) vs multiple (checkbox semantics —\n * `value` is a `string[]`); defaults to `false` (multiple). Controlled (`value` + `onChange`) or\n * uncontrolled (`defaultValue`); supply the cards via the data-driven `options` prop (`{ value, label,\n * description?, icon?, disabled? }[]`) or as `<ChoiceCard>` children. The cards lay out on a\n * **responsive grid** (`minCardWidth`, default `160` — as many per row as fit, wrapping below). Binds\n * to a surrounding `<Form>` by **`name`** — the form value is a `string` when `exclusive` (validate\n * with e.g. `z.string().min(1)`), else a `string[]` (`z.array(z.string()).min(1)`); the form's `error`\n * reddens the card borders (no message text, like `RadioGroup`). `role=\"radiogroup\"` / `\"group\"`;\n * styling uses `--tz-*` tokens via the shared `--tz-btn-rgb` pattern.\n */\nexport const ChoiceCardGroup = forwardRef<HTMLDivElement, ChoiceCardGroupProps>(\n function ChoiceCardGroup(\n {\n exclusive = false,\n value,\n defaultValue,\n onChange,\n name,\n options,\n label,\n minCardWidth = 160,\n align,\n size = 'md',\n color = 'primary',\n error,\n required = false,\n disabled = false,\n children,\n className,\n style,\n ...props\n },\n ref,\n ) {\n // exclusive cards are native radios — they need a shared input name even without a form\n const reactId = useId()\n const resolvedName = name ?? `choice-${reactId}`\n\n // Auto-bind to a surrounding <Form> by `name` — the form value mirrors the `exclusive` shape.\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue: string | string[] | null | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? (form!.values[name!] as string | string[] | null | undefined)\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<string | string[] | null | undefined>(defaultValue)\n const current = isControlled ? externalValue : internal\n\n const resolvedError = error ?? bound?.error ?? false\n\n const isSelected = (v: string) =>\n exclusive ? current === v : Array.isArray(current) && current.includes(v)\n\n const toggle = (v: string) => {\n let next: string | string[] | null\n if (exclusive) {\n next = v // radio semantics — selecting again keeps it selected\n } else {\n const arr = Array.isArray(current) ? current : []\n next = arr.includes(v) ? arr.filter((x) => x !== v) : [...arr, v]\n }\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n const ctx: ChoiceCardGroupContextValue = {\n name: resolvedName,\n exclusive,\n isSelected,\n toggle,\n size,\n align,\n color,\n disabled,\n error: resolvedError,\n }\n\n return (\n <div\n ref={ref}\n role={exclusive ? 'radiogroup' : 'group'}\n aria-invalid={resolvedError || undefined}\n className={clsx(styles.group, className)}\n style={style as CSSProperties}\n {...props}\n >\n {label != null && (\n <span className={styles.groupLabel}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n )}\n\n <div className={styles.grid} style={{ '--cc-min': `${minCardWidth}px` } as CSSProperties}>\n <ChoiceCardGroupContext.Provider value={ctx}>\n {options\n ? options.map((option) => (\n <ChoiceCard\n key={option.value}\n value={option.value}\n label={option.label}\n description={option.description}\n icon={option.icon}\n disabled={option.disabled}\n />\n ))\n : children}\n </ChoiceCardGroupContext.Provider>\n </div>\n </div>\n )\n },\n)\n"],"names":["ChoiceCardGroupContext","createContext","useChoiceCardGroupContext","useContext","ICON_NAME_SET","ICON_NAMES","ChoiceCard","forwardRef","value","label","description","icon","align","color","size","error","checked","onChange","name","disabled","className","style","props","ref","group","resolvedColor","resolvedSize","resolvedError","resolvedDisabled","resolvedName","resolvedAlign","internal","setInternal","useState","isChecked","handleChange","event","iconNode","jsx","Icon","jsxs","clsx","styles","ChoiceCardGroup","exclusive","defaultValue","options","minCardWidth","required","children","reactId","useId","form","useFormContext","isFormBound","bound","externalValue","isControlled","current","ctx","v","next","arr","x","Typography","option"],"mappings":"uMAqBaA,EAAyBC,EAAAA,cAAkD,IAAI,EAGrF,SAASC,GAAgE,CAC9E,OAAOC,EAAAA,WAAWH,CAAsB,CAC1C,wlBCXMI,GAAgB,IAAI,IAAYC,YAAU,EA4CnCC,EAAaC,EAAAA,WAA8C,SACtE,CACE,MAAAC,EACA,MAAAC,EACA,YAAAC,EACA,KAAAC,EACA,MAAAC,EACA,MAAAC,EACA,KAAAC,EACA,MAAAC,EACA,QAAAC,EACA,SAAAC,EACA,KAAAC,EACA,SAAAC,EACA,UAAAC,EACA,MAAAC,EACA,GAAGC,CACL,EACAC,EACA,CACA,MAAMC,EAAQtB,EAAA,EAERuB,EAAgBZ,IAASW,GAAA,YAAAA,EAAO,QAAS,UACzCE,EAAeZ,IAAQU,GAAA,YAAAA,EAAO,OAAQ,KACtCG,EAAgBZ,IAASS,GAAA,YAAAA,EAAO,QAAS,GACzCI,EAAmBT,IAAYK,GAAA,YAAAA,EAAO,WAAY,GAClDK,EAAeX,IAAQM,GAAA,YAAAA,EAAO,MAE9BM,EAAgBlB,IAASY,GAAA,YAAAA,EAAO,SAAUb,GAAQ,KAAO,OAAS,UAGlE,CAACoB,EAAUC,CAAW,EAAIC,EAAAA,SA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EAAIE,EAAI,OAAQC,GAAMA,IAAMH,CAAC,EAAI,CAAC,GAAGE,EAAKF,CAAC,CAClE,CACKH,GAAczB,EAAY6B,CAAI,EAC/BP,GAAaF,EAAM,SAASlC,EAAO2C,CAAI,EAC3C5C,GAAA,MAAAA,EAAW4C,EACb,EAOE,KAAA/C,EACA,MAAAF,EACA,MAAAC,EACA,SAAAM,EACA,MAAOQ,CAAA,EAGT,OACEa,EAAAA,KAAC,MAAA,CACC,IAAAjB,EACA,KAAMqB,EAAY,aAAe,QACjC,eAAcjB,GAAiB,OAC/B,UAAWc,EAAAA,KAAKC,EAAO,MAAOtB,CAAS,EACvC,MAAAC,EACC,GAAGC,EAEH,SAAA,CAAAb,GAAS,MACR+B,EAAAA,KAAC,OAAA,CAAK,UAAWE,EAAO,WACtB,SAAA,CAAAJ,EAAAA,IAAC0B,EAAAA,YAAW,GAAG,OAAO,QAAQ,YAAY,MAAM,QAC7C,SAAAvD,CAAA,CACH,EACCuC,SACE,OAAA,CAAK,UAAWN,EAAO,SAAU,cAAY,OAAO,SAAA,GAAA,CAErD,CAAA,EAEJ,EAGFJ,EAAAA,IAAC,OAAI,UAAWI,EAAO,KAAM,MAAO,CAAE,WAAY,GAAGK,CAAY,IAAA,EAC/D,SAAAT,EAAAA,IAACtC,EAAuB,SAAvB,CAAgC,MAAO2D,EACrC,SAAAb,EACGA,EAAQ,IAAKmB,GACX3B,EAAAA,IAAChC,EAAA,CAEC,MAAO2D,EAAO,MACd,MAAOA,EAAO,MACd,YAAaA,EAAO,YACpB,KAAMA,EAAO,KACb,SAAUA,EAAO,QAAA,EALZA,EAAO,KAAA,CAOf,EACDhB,CAAA,CACN,CAAA,CACF,CAAA,CAAA,CAAA,CAGN,CACF"}
@@ -1,2 +1,2 @@
1
- "use strict";var k=Object.create;var b=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var E=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of I(e))!g.call(t,n)&&n!==s&&b(t,n,{get:()=>e[n],enumerable:!(i=q(e,n))||i.enumerable});return t};var z=(t,e,s)=>(s=t!=null?k(S(t)):{},E(e||!t||!t.__esModule?b(s,"default",{value:t,enumerable:!0}):s,t));const o=require("react/jsx-runtime"),r=require("react"),j=require("clsx"),R=require("./IconButton-DSPdv-oI.cjs"),M=require("./Icon-CBg21lKA.cjs"),P=require("./Tooltip-DmMq5R1x.cjs"),D=require("./ConfigProvider-CYSpuSMJ.cjs"),H="_root_wvbjf_4",L="_header_wvbjf_15",O="_title_wvbjf_24",A="_code_wvbjf_34",F="_plain_wvbjf_50",G="_wrap_wvbjf_56",J="_lineNumbers_wvbjf_62",K="_copy_wvbjf_77",c={root:H,header:L,title:O,code:A,plain:F,wrap:G,lineNumbers:J,copy:K},Q=1600,U=r.forwardRef(function({code:e,language:s="tsx",title:i,copyable:n=!0,showLineNumbers:v=!0,maxHeight:_,wrap:x=!1,className:y,style:N,...B},C){const a=D.useT(),[f,h]=r.useState(null),[d,m]=r.useState(!1),u=r.useRef(void 0);r.useEffect(()=>{let l=!1;return import("shiki").then(({codeToHtml:p})=>p(e,{lang:s,theme:"dark-plus"})).then(p=>{l||h(p)}).catch(()=>{l||h(null)}),()=>{l=!0}},[e,s]),r.useEffect(()=>()=>window.clearTimeout(u.current),[]);const T=()=>{var l;(l=navigator.clipboard)==null||l.writeText(e).then(()=>{m(!0),window.clearTimeout(u.current),u.current=window.setTimeout(()=>m(!1),Q)}).catch(()=>{})},w=n&&o.jsx(P.Tooltip,{content:a(d?"codeBlock.copied":"codeBlock.copy"),placement:"left",style:{"--tz-btn-rgb":"255, 255, 255","--tz-btn-on":"#1e1e1e"},children:o.jsx(R.IconButton,{variant:"text",size:"sm",className:c.copy,style:{"--tz-btn-rgb":"255, 255, 255"},"aria-label":a(d?"codeBlock.copied":"codeBlock.copy"),onClick:T,children:o.jsx(M.Icon,{name:d?"CopySuccess":"Copy"})})});return o.jsxs("div",{ref:C,className:j.clsx(c.root,y),style:N,...B,children:[(i!=null||w)&&o.jsxs("div",{className:c.header,children:[o.jsx("span",{className:c.title,children:i}),w]}),o.jsx("div",{className:j.clsx(c.code,x&&c.wrap,v&&c.lineNumbers),style:_!=null?{maxHeight:_}:void 0,children:f!=null?o.jsx("div",{className:c.highlighted,dangerouslySetInnerHTML:{__html:f}}):o.jsx("pre",{className:c.plain,children:o.jsx("code",{children:e})})})]})});exports.CodeBlock=U;
2
- //# sourceMappingURL=CodeBlock-rnGAu2DQ.cjs.map
1
+ "use strict";var k=Object.create;var b=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var E=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of I(e))!g.call(t,n)&&n!==s&&b(t,n,{get:()=>e[n],enumerable:!(i=q(e,n))||i.enumerable});return t};var z=(t,e,s)=>(s=t!=null?k(S(t)):{},E(e||!t||!t.__esModule?b(s,"default",{value:t,enumerable:!0}):s,t));const o=require("react/jsx-runtime"),r=require("react"),j=require("clsx"),R=require("./IconButton-ChhZqleN.cjs"),M=require("./Icon-BoQmbW7j.cjs"),P=require("./Tooltip-DmMq5R1x.cjs"),D=require("./ConfigProvider-BFhkb0BV.cjs"),H="_root_wvbjf_4",L="_header_wvbjf_15",O="_title_wvbjf_24",A="_code_wvbjf_34",F="_plain_wvbjf_50",G="_wrap_wvbjf_56",J="_lineNumbers_wvbjf_62",K="_copy_wvbjf_77",c={root:H,header:L,title:O,code:A,plain:F,wrap:G,lineNumbers:J,copy:K},Q=1600,U=r.forwardRef(function({code:e,language:s="tsx",title:i,copyable:n=!0,showLineNumbers:v=!0,maxHeight:_,wrap:x=!1,className:y,style:N,...B},C){const a=D.useT(),[f,h]=r.useState(null),[d,m]=r.useState(!1),u=r.useRef(void 0);r.useEffect(()=>{let l=!1;return import("shiki").then(({codeToHtml:p})=>p(e,{lang:s,theme:"dark-plus"})).then(p=>{l||h(p)}).catch(()=>{l||h(null)}),()=>{l=!0}},[e,s]),r.useEffect(()=>()=>window.clearTimeout(u.current),[]);const T=()=>{var l;(l=navigator.clipboard)==null||l.writeText(e).then(()=>{m(!0),window.clearTimeout(u.current),u.current=window.setTimeout(()=>m(!1),Q)}).catch(()=>{})},w=n&&o.jsx(P.Tooltip,{content:a(d?"codeBlock.copied":"codeBlock.copy"),placement:"left",style:{"--tz-btn-rgb":"255, 255, 255","--tz-btn-on":"#1e1e1e"},children:o.jsx(R.IconButton,{variant:"text",size:"sm",className:c.copy,style:{"--tz-btn-rgb":"255, 255, 255"},"aria-label":a(d?"codeBlock.copied":"codeBlock.copy"),onClick:T,children:o.jsx(M.Icon,{name:d?"CopySuccess":"Copy"})})});return o.jsxs("div",{ref:C,className:j.clsx(c.root,y),style:N,...B,children:[(i!=null||w)&&o.jsxs("div",{className:c.header,children:[o.jsx("span",{className:c.title,children:i}),w]}),o.jsx("div",{className:j.clsx(c.code,x&&c.wrap,v&&c.lineNumbers),style:_!=null?{maxHeight:_}:void 0,children:f!=null?o.jsx("div",{className:c.highlighted,dangerouslySetInnerHTML:{__html:f}}):o.jsx("pre",{className:c.plain,children:o.jsx("code",{children:e})})})]})});exports.CodeBlock=U;
2
+ //# sourceMappingURL=CodeBlock-B404V_cc.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlock-rnGAu2DQ.cjs","sources":["../src/components/CodeBlock/CodeBlock.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { IconButton } from '../IconButton'\nimport { Icon } from '../Icon'\nimport { Tooltip } from '../Tooltip'\nimport styles from './CodeBlock.module.css'\n\n// how long the copy button shows the \"copied\" tick before reverting\nconst COPIED_RESET_MS = 1600\n\nexport interface CodeBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'title'> {\n /** The source code to render. */\n code: string\n /** Shiki language id (`'tsx'`, `'json'`, `'bash'`, `'css'`, …). Defaults to `'tsx'`. */\n language?: string\n /**\n * Optional label shown on the left of the header bar (e.g. a filename). The header bar itself always\n * renders (whenever `copyable`), so the copy button lives in it with or without a `title`.\n */\n title?: ReactNode\n /** Show a copy-to-clipboard button (in the header bar). Defaults to `true`. */\n copyable?: boolean\n /** Show line numbers. Defaults to `true`. */\n showLineNumbers?: boolean\n /** Cap the block height in px — taller code scrolls inside. */\n maxHeight?: number\n /** Soft-wrap long lines instead of scrolling horizontally. Defaults to `false`. */\n wrap?: boolean\n}\n\n/**\n * A syntax-highlighted code block with **VS Code colors** — powered by **Shiki** (an optional peer,\n * `npm i shiki`), the actual VS Code highlighting engine, using its **`dark-plus`** theme. The block\n * is **always dark** (in both app modes) — code reads best on a dark surface, and the deep background\n * anchors it regardless of the surrounding light/dark theme. Highlighting is **async and lazy**\n * (`import('shiki')` on first render); until it lands — or if `shiki` isn't installed / the language\n * is unknown — the block shows the plain code (on the same dark surface), so nothing breaks. A header\n * bar always renders (whenever `copyable`, default `true`) and holds the copy button — which flips to a\n * tick on click — with an optional `title` (e.g. a filename) on its left; `showLineNumbers` (default\n * `true`), `maxHeight` (scrolls inside) and `wrap` shape the body. The whole block\n * keeps VS Code's own dark colors (a deliberate literal-color exception, like the Modal scrim); only\n * the outer radius uses a `--tz-*` token (the border is a literal white-alpha hairline).\n */\nexport const CodeBlock = forwardRef<HTMLDivElement, CodeBlockProps>(function CodeBlock(\n {\n code,\n language = 'tsx',\n title,\n copyable = true,\n showLineNumbers = true,\n maxHeight,\n wrap = false,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const [html, setHtml] = useState<string | null>(null)\n const [copied, setCopied] = useState(false)\n const copyTimer = useRef<number | undefined>(undefined)\n\n // highlight asynchronously — shiki is an optional peer, loaded lazily on first use; a missing\n // package or an unknown language just leaves the plain (unhighlighted) fallback in place\n useEffect(() => {\n let cancelled = false\n import('shiki')\n .then(({ codeToHtml }) =>\n codeToHtml(code, {\n lang: language,\n // always VS Code's dark theme — the block stays dark in both app modes\n theme: 'dark-plus',\n }),\n )\n .then((out) => {\n if (!cancelled) setHtml(out)\n })\n .catch(() => {\n if (!cancelled) setHtml(null)\n })\n return () => {\n cancelled = true\n }\n }, [code, language])\n\n useEffect(() => () => window.clearTimeout(copyTimer.current), [])\n\n const handleCopy = () => {\n navigator.clipboard\n ?.writeText(code)\n .then(() => {\n setCopied(true)\n window.clearTimeout(copyTimer.current)\n copyTimer.current = window.setTimeout(() => setCopied(false), COPIED_RESET_MS)\n })\n .catch(() => {})\n }\n\n const copyButton = copyable && (\n // the tooltip is hover/focus-driven; clicking flips `copied`, so its content updates to \"Copied!\"\n // while it's still open (the pointer is on the button). `left` keeps it inside the block's\n // `overflow: hidden` bounds.\n <Tooltip\n content={copied ? t('codeBlock.copied') : t('codeBlock.copy')}\n placement=\"left\"\n // always a white pill with dark text over the (always-dark) block — set via `style` so it beats\n // Tooltip's own color-derived --tz-btn-rgb (which is spread before the consumer `style`)\n style={{ '--tz-btn-rgb': '255, 255, 255', '--tz-btn-on': '#1e1e1e' } as CSSProperties}\n >\n <IconButton\n variant=\"text\"\n size=\"sm\"\n className={styles.copy}\n // force the button light over the dark surface — passed via `style` so it beats IconButton's\n // own inline `--tz-btn-rgb` (which is spread before the consumer `style`, so this wins)\n style={{ '--tz-btn-rgb': '255, 255, 255' } as CSSProperties}\n aria-label={copied ? t('codeBlock.copied') : t('codeBlock.copy')}\n onClick={handleCopy}\n >\n <Icon name={copied ? 'CopySuccess' : 'Copy'} />\n </IconButton>\n </Tooltip>\n )\n\n return (\n <div ref={ref} className={clsx(styles.root, className)} style={style} {...props}>\n {/* the header bar always renders whenever there's a title or a copy button — so the copy icon\n lives in the bar (top-right), never floating over the code */}\n {(title != null || copyButton) && (\n <div className={styles.header}>\n <span className={styles.title}>{title}</span>\n {copyButton}\n </div>\n )}\n <div\n className={clsx(styles.code, wrap && styles.wrap, showLineNumbers && styles.lineNumbers)}\n style={maxHeight != null ? ({ maxHeight } as CSSProperties) : undefined}\n >\n {html != null ? (\n // shiki output is trusted markup — it escapes the source code itself\n <div className={styles.highlighted} dangerouslySetInnerHTML={{ __html: html }} />\n ) : (\n <pre className={styles.plain}>\n <code>{code}</code>\n </pre>\n )}\n </div>\n </div>\n )\n})\n"],"names":["COPIED_RESET_MS","CodeBlock","forwardRef","code","language","title","copyable","showLineNumbers","maxHeight","wrap","className","style","props","ref","t","useT","html","setHtml","useState","copied","setCopied","copyTimer","useRef","useEffect","cancelled","codeToHtml","out","handleCopy","_a","copyButton","jsx","Tooltip","IconButton","styles","Icon","jsxs","clsx"],"mappings":"k6BAiBMA,EAAkB,KAmCXC,EAAYC,EAAAA,WAA2C,SAClE,CACE,KAAAC,EACA,SAAAC,EAAW,MACX,MAAAC,EACA,SAAAC,EAAW,GACX,gBAAAC,EAAkB,GAClB,UAAAC,EACA,KAAAC,EAAO,GACP,UAAAC,EACA,MAAAC,EACA,GAAGC,CACL,EACAC,EACA,CACA,MAAMC,EAAIC,EAAAA,KAAA,EACJ,CAACC,EAAMC,CAAO,EAAIC,EAAAA,SAAwB,IAAI,EAC9C,CAACC,EAAQC,CAAS,EAAIF,EAAAA,SAAS,EAAK,EACpCG,EAAYC,EAAAA,OAA2B,MAAS,EAItDC,EAAAA,UAAU,IAAM,CACd,IAAIC,EAAY,GAChB,cAAO,OAAO,EACX,KAAK,CAAC,CAAE,WAAAC,CAAA,IACPA,EAAWtB,EAAM,CACf,KAAMC,EAEN,MAAO,WAAA,CACR,CAAA,EAEF,KAAMsB,GAAQ,CACRF,GAAWP,EAAQS,CAAG,CAC7B,CAAC,EACA,MAAM,IAAM,CACNF,GAAWP,EAAQ,IAAI,CAC9B,CAAC,EACI,IAAM,CACXO,EAAY,EACd,CACF,EAAG,CAACrB,EAAMC,CAAQ,CAAC,EAEnBmB,EAAAA,U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Aa,wBAAyB,CAAE,OAAQjB,EAAK,CAAG,EAE/Ec,EAAAA,IAAC,OAAI,UAAWG,EAAO,MACrB,SAAAH,EAAAA,IAAC,OAAA,CAAM,WAAK,CAAA,CACd,CAAA,CAAA,CAEJ,EACF,CAEJ,CAAC"}
1
+ {"version":3,"file":"CodeBlock-B404V_cc.cjs","sources":["../src/components/CodeBlock/CodeBlock.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { IconButton } from '../IconButton'\nimport { Icon } from '../Icon'\nimport { Tooltip } from '../Tooltip'\nimport styles from './CodeBlock.module.css'\n\n// how long the copy button shows the \"copied\" tick before reverting\nconst COPIED_RESET_MS = 1600\n\nexport interface CodeBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'title'> {\n /** The source code to render. */\n code: string\n /** Shiki language id (`'tsx'`, `'json'`, `'bash'`, `'css'`, …). Defaults to `'tsx'`. */\n language?: string\n /**\n * Optional label shown on the left of the header bar (e.g. a filename). The header bar itself always\n * renders (whenever `copyable`), so the copy button lives in it with or without a `title`.\n */\n title?: ReactNode\n /** Show a copy-to-clipboard button (in the header bar). Defaults to `true`. */\n copyable?: boolean\n /** Show line numbers. Defaults to `true`. */\n showLineNumbers?: boolean\n /** Cap the block height in px — taller code scrolls inside. */\n maxHeight?: number\n /** Soft-wrap long lines instead of scrolling horizontally. Defaults to `false`. */\n wrap?: boolean\n}\n\n/**\n * A syntax-highlighted code block with **VS Code colors** — powered by **Shiki** (an optional peer,\n * `npm i shiki`), the actual VS Code highlighting engine, using its **`dark-plus`** theme. The block\n * is **always dark** (in both app modes) — code reads best on a dark surface, and the deep background\n * anchors it regardless of the surrounding light/dark theme. Highlighting is **async and lazy**\n * (`import('shiki')` on first render); until it lands — or if `shiki` isn't installed / the language\n * is unknown — the block shows the plain code (on the same dark surface), so nothing breaks. A header\n * bar always renders (whenever `copyable`, default `true`) and holds the copy button — which flips to a\n * tick on click — with an optional `title` (e.g. a filename) on its left; `showLineNumbers` (default\n * `true`), `maxHeight` (scrolls inside) and `wrap` shape the body. The whole block\n * keeps VS Code's own dark colors (a deliberate literal-color exception, like the Modal scrim); only\n * the outer radius uses a `--tz-*` token (the border is a literal white-alpha hairline).\n */\nexport const CodeBlock = forwardRef<HTMLDivElement, CodeBlockProps>(function CodeBlock(\n {\n code,\n language = 'tsx',\n title,\n copyable = true,\n showLineNumbers = true,\n maxHeight,\n wrap = false,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const [html, setHtml] = useState<string | null>(null)\n const [copied, setCopied] = useState(false)\n const copyTimer = useRef<number | undefined>(undefined)\n\n // highlight asynchronously — shiki is an optional peer, loaded lazily on first use; a missing\n // package or an unknown language just leaves the plain (unhighlighted) fallback in place\n useEffect(() => {\n let cancelled = false\n import('shiki')\n .then(({ codeToHtml }) =>\n codeToHtml(code, {\n lang: language,\n // always VS Code's dark theme — the block stays dark in both app modes\n theme: 'dark-plus',\n }),\n )\n .then((out) => {\n if (!cancelled) setHtml(out)\n })\n .catch(() => {\n if (!cancelled) setHtml(null)\n })\n return () => {\n cancelled = true\n }\n }, [code, language])\n\n useEffect(() => () => window.clearTimeout(copyTimer.current), [])\n\n const handleCopy = () => {\n navigator.clipboard\n ?.writeText(code)\n .then(() => {\n setCopied(true)\n window.clearTimeout(copyTimer.current)\n copyTimer.current = window.setTimeout(() => setCopied(false), COPIED_RESET_MS)\n })\n .catch(() => {})\n }\n\n const copyButton = copyable && (\n // the tooltip is hover/focus-driven; clicking flips `copied`, so its content updates to \"Copied!\"\n // while it's still open (the pointer is on the button). `left` keeps it inside the block's\n // `overflow: hidden` bounds.\n <Tooltip\n content={copied ? t('codeBlock.copied') : t('codeBlock.copy')}\n placement=\"left\"\n // always a white pill with dark text over the (always-dark) block — set via `style` so it beats\n // Tooltip's own color-derived --tz-btn-rgb (which is spread before the consumer `style`)\n style={{ '--tz-btn-rgb': '255, 255, 255', '--tz-btn-on': '#1e1e1e' } as CSSProperties}\n >\n <IconButton\n variant=\"text\"\n size=\"sm\"\n className={styles.copy}\n // force the button light over the dark surface — passed via `style` so it beats IconButton's\n // own inline `--tz-btn-rgb` (which is spread before the consumer `style`, so this wins)\n style={{ '--tz-btn-rgb': '255, 255, 255' } as CSSProperties}\n aria-label={copied ? t('codeBlock.copied') : t('codeBlock.copy')}\n onClick={handleCopy}\n >\n <Icon name={copied ? 'CopySuccess' : 'Copy'} />\n </IconButton>\n </Tooltip>\n )\n\n return (\n <div ref={ref} className={clsx(styles.root, className)} style={style} {...props}>\n {/* the header bar always renders whenever there's a title or a copy button — so the copy icon\n lives in the bar (top-right), never floating over the code */}\n {(title != null || copyButton) && (\n <div className={styles.header}>\n <span className={styles.title}>{title}</span>\n {copyButton}\n </div>\n )}\n <div\n className={clsx(styles.code, wrap && styles.wrap, showLineNumbers && styles.lineNumbers)}\n style={maxHeight != null ? ({ maxHeight } as CSSProperties) : undefined}\n >\n {html != null ? (\n // shiki output is trusted markup — it escapes the source code itself\n <div className={styles.highlighted} dangerouslySetInnerHTML={{ __html: html }} />\n ) : (\n <pre className={styles.plain}>\n <code>{code}</code>\n </pre>\n )}\n </div>\n </div>\n )\n})\n"],"names":["COPIED_RESET_MS","CodeBlock","forwardRef","code","language","title","copyable","showLineNumbers","maxHeight","wrap","className","style","props","ref","t","useT","html","setHtml","useState","copied","setCopied","copyTimer","useRef","useEffect","cancelled","codeToHtml","out","handleCopy","_a","copyButton","jsx","Tooltip","IconButton","styles","Icon","jsxs","clsx"],"mappings":"k6BAiBMA,EAAkB,KAmCXC,EAAYC,EAAAA,WAA2C,SAClE,CACE,KAAAC,EACA,SAAAC,EAAW,MACX,MAAAC,EACA,SAAAC,EAAW,GACX,gBAAAC,EAAkB,GAClB,UAAAC,EACA,KAAAC,EAAO,GACP,UAAAC,EACA,MAAAC,EACA,GAAGC,CACL,EACAC,EAC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AA,CAC/C,CAAA,EAIJ,OACEgB,EAAAA,KAAC,MAAA,CAAI,IAAAtB,EAAU,UAAWuB,EAAAA,KAAKH,EAAO,KAAMvB,CAAS,EAAG,MAAAC,EAAe,GAAGC,EAGtE,SAAA,EAAAP,GAAS,MAAQwB,IACjBM,EAAAA,KAAC,MAAA,CAAI,UAAWF,EAAO,OACrB,SAAA,CAAAH,EAAAA,IAAC,OAAA,CAAK,UAAWG,EAAO,MAAQ,SAAA5B,EAAM,EACrCwB,CAAA,EACH,EAEFC,EAAAA,IAAC,MAAA,CACC,UAAWM,EAAAA,KAAKH,EAAO,KAAMxB,GAAQwB,EAAO,KAAM1B,GAAmB0B,EAAO,WAAW,EACvF,MAAOzB,GAAa,KAAQ,CAAE,UAAAA,GAAgC,OAE7D,SAAAQ,GAAQ,KAEPc,MAAC,OAAI,UAAWG,EAAO,YAAa,wBAAyB,CAAE,OAAQjB,EAAK,CAAG,EAE/Ec,EAAAA,IAAC,OAAI,UAAWG,EAAO,MACrB,SAAAH,EAAAA,IAAC,OAAA,CAAM,WAAK,CAAA,CACd,CAAA,CAAA,CAEJ,EACF,CAEJ,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import { jsx as t, jsxs as _ } from "react/jsx-runtime";
2
2
  import { forwardRef as x, useState as h, useRef as I, useEffect as b } from "react";
3
3
  import { clsx as w } from "clsx";
4
- import { I as S } from "./IconButton-iWbUJAz7.js";
5
- import { b as g } from "./Icon-B7DJn8Tw.js";
4
+ import { I as S } from "./IconButton-s5hohjxu.js";
5
+ import { b as g } from "./Icon-DMMO32p6.js";
6
6
  import { T as z } from "./Tooltip-BbT0uNzy.js";
7
- import { a as E } from "./ConfigProvider-DtyUlWk6.js";
7
+ import { a as E } from "./ConfigProvider-bXX8dnhY.js";
8
8
  const R = "_root_wvbjf_4", M = "_header_wvbjf_15", D = "_title_wvbjf_24", H = "_code_wvbjf_34", L = "_plain_wvbjf_50", O = "_wrap_wvbjf_56", P = "_lineNumbers_wvbjf_62", q = "_copy_wvbjf_77", e = {
9
9
  root: R,
10
10
  header: M,
@@ -93,4 +93,4 @@ const R = "_root_wvbjf_4", M = "_header_wvbjf_15", D = "_title_wvbjf_24", H = "_
93
93
  export {
94
94
  X as C
95
95
  };
96
- //# sourceMappingURL=CodeBlock-CX8_dMPD.js.map
96
+ //# sourceMappingURL=CodeBlock-DvJ45qEp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlock-CX8_dMPD.js","sources":["../src/components/CodeBlock/CodeBlock.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { IconButton } from '../IconButton'\nimport { Icon } from '../Icon'\nimport { Tooltip } from '../Tooltip'\nimport styles from './CodeBlock.module.css'\n\n// how long the copy button shows the \"copied\" tick before reverting\nconst COPIED_RESET_MS = 1600\n\nexport interface CodeBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'title'> {\n /** The source code to render. */\n code: string\n /** Shiki language id (`'tsx'`, `'json'`, `'bash'`, `'css'`, …). Defaults to `'tsx'`. */\n language?: string\n /**\n * Optional label shown on the left of the header bar (e.g. a filename). The header bar itself always\n * renders (whenever `copyable`), so the copy button lives in it with or without a `title`.\n */\n title?: ReactNode\n /** Show a copy-to-clipboard button (in the header bar). Defaults to `true`. */\n copyable?: boolean\n /** Show line numbers. Defaults to `true`. */\n showLineNumbers?: boolean\n /** Cap the block height in px — taller code scrolls inside. */\n maxHeight?: number\n /** Soft-wrap long lines instead of scrolling horizontally. Defaults to `false`. */\n wrap?: boolean\n}\n\n/**\n * A syntax-highlighted code block with **VS Code colors** — powered by **Shiki** (an optional peer,\n * `npm i shiki`), the actual VS Code highlighting engine, using its **`dark-plus`** theme. The block\n * is **always dark** (in both app modes) — code reads best on a dark surface, and the deep background\n * anchors it regardless of the surrounding light/dark theme. Highlighting is **async and lazy**\n * (`import('shiki')` on first render); until it lands — or if `shiki` isn't installed / the language\n * is unknown — the block shows the plain code (on the same dark surface), so nothing breaks. A header\n * bar always renders (whenever `copyable`, default `true`) and holds the copy button — which flips to a\n * tick on click — with an optional `title` (e.g. a filename) on its left; `showLineNumbers` (default\n * `true`), `maxHeight` (scrolls inside) and `wrap` shape the body. The whole block\n * keeps VS Code's own dark colors (a deliberate literal-color exception, like the Modal scrim); only\n * the outer radius uses a `--tz-*` token (the border is a literal white-alpha hairline).\n */\nexport const CodeBlock = forwardRef<HTMLDivElement, CodeBlockProps>(function CodeBlock(\n {\n code,\n language = 'tsx',\n title,\n copyable = true,\n showLineNumbers = true,\n maxHeight,\n wrap = false,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const [html, setHtml] = useState<string | null>(null)\n const [copied, setCopied] = useState(false)\n const copyTimer = useRef<number | undefined>(undefined)\n\n // highlight asynchronously — shiki is an optional peer, loaded lazily on first use; a missing\n // package or an unknown language just leaves the plain (unhighlighted) fallback in place\n useEffect(() => {\n let cancelled = false\n import('shiki')\n .then(({ codeToHtml }) =>\n codeToHtml(code, {\n lang: language,\n // always VS Code's dark theme — the block stays dark in both app modes\n theme: 'dark-plus',\n }),\n )\n .then((out) => {\n if (!cancelled) setHtml(out)\n })\n .catch(() => {\n if (!cancelled) setHtml(null)\n })\n return () => {\n cancelled = true\n }\n }, [code, language])\n\n useEffect(() => () => window.clearTimeout(copyTimer.current), [])\n\n const handleCopy = () => {\n navigator.clipboard\n ?.writeText(code)\n .then(() => {\n setCopied(true)\n window.clearTimeout(copyTimer.current)\n copyTimer.current = window.setTimeout(() => setCopied(false), COPIED_RESET_MS)\n })\n .catch(() => {})\n }\n\n const copyButton = copyable && (\n // the tooltip is hover/focus-driven; clicking flips `copied`, so its content updates to \"Copied!\"\n // while it's still open (the pointer is on the button). `left` keeps it inside the block's\n // `overflow: hidden` bounds.\n <Tooltip\n content={copied ? t('codeBlock.copied') : t('codeBlock.copy')}\n placement=\"left\"\n // always a white pill with dark text over the (always-dark) block — set via `style` so it beats\n // Tooltip's own color-derived --tz-btn-rgb (which is spread before the consumer `style`)\n style={{ '--tz-btn-rgb': '255, 255, 255', '--tz-btn-on': '#1e1e1e' } as CSSProperties}\n >\n <IconButton\n variant=\"text\"\n size=\"sm\"\n className={styles.copy}\n // force the button light over the dark surface — passed via `style` so it beats IconButton's\n // own inline `--tz-btn-rgb` (which is spread before the consumer `style`, so this wins)\n style={{ '--tz-btn-rgb': '255, 255, 255' } as CSSProperties}\n aria-label={copied ? t('codeBlock.copied') : t('codeBlock.copy')}\n onClick={handleCopy}\n >\n <Icon name={copied ? 'CopySuccess' : 'Copy'} />\n </IconButton>\n </Tooltip>\n )\n\n return (\n <div ref={ref} className={clsx(styles.root, className)} style={style} {...props}>\n {/* the header bar always renders whenever there's a title or a copy button — so the copy icon\n lives in the bar (top-right), never floating over the code */}\n {(title != null || copyButton) && (\n <div className={styles.header}>\n <span className={styles.title}>{title}</span>\n {copyButton}\n </div>\n )}\n <div\n className={clsx(styles.code, wrap && styles.wrap, showLineNumbers && styles.lineNumbers)}\n style={maxHeight != null ? ({ maxHeight } as CSSProperties) : undefined}\n >\n {html != null ? (\n // shiki output is trusted markup — it escapes the source code itself\n <div className={styles.highlighted} dangerouslySetInnerHTML={{ __html: html }} />\n ) : (\n <pre className={styles.plain}>\n <code>{code}</code>\n </pre>\n )}\n </div>\n </div>\n )\n})\n"],"names":["COPIED_RESET_MS","CodeBlock","forwardRef","code","language","title","copyable","showLineNumbers","maxHeight","wrap","className","style","props","ref","t","useT","html","setHtml","useState","copied","setCopied","copyTimer","useRef","useEffect","cancelled","codeToHtml","out","handleCopy","_a","copyButton","jsx","Tooltip","IconButton","styles","Icon","jsxs","clsx"],"mappings":";;;;;;;;;;;;;;;;GAiBMA,IAAkB,MAmCXC,IAAYC,EAA2C,SAClE;AAAA,EACE,MAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,OAAAC;AAAA,EACA,UAAAC,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{\n forwardRef,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { IconButton } from '../IconButton'\nimport { Icon } from '../Icon'\nimport { Tooltip } from '../Tooltip'\nimport styles from './CodeBlock.module.css'\n\n// how long the copy button shows the \"copied\" tick before reverting\nconst COPIED_RESET_MS = 1600\n\nexport interface CodeBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'title'> {\n /** The source code to render. */\n code: string\n /** Shiki language id (`'tsx'`, `'json'`, `'bash'`, `'css'`, …). Defaults to `'tsx'`. */\n language?: string\n /**\n * Optional label shown on the left of the header bar (e.g. a filename). The header bar itself always\n * renders (whenever `copyable`), so the copy button lives in it with or without a `title`.\n */\n title?: ReactNode\n /** Show a copy-to-clipboard button (in the header bar). Defaults to `true`. */\n copyable?: boolean\n /** Show line numbers. Defaults to `true`. */\n showLineNumbers?: boolean\n /** Cap the block height in px — taller code scrolls inside. */\n maxHeight?: number\n /** Soft-wrap long lines instead of scrolling horizontally. Defaults to `false`. */\n wrap?: boolean\n}\n\n/**\n * A syntax-highlighted code block with **VS Code colors** — powered by **Shiki** (an optional peer,\n * `npm i shiki`), the actual VS Code highlighting engine, using its **`dark-plus`** theme. The block\n * is **always dark** (in both app modes) — code reads best on a dark surface, and the deep background\n * anchors it regardless of the surrounding light/dark theme. Highlighting is **async and lazy**\n * (`import('shiki')` on first render); until it lands — or if `shiki` isn't installed / the language\n * is unknown — the block shows the plain code (on the same dark surface), so nothing breaks. A header\n * bar always renders (whenever `copyable`, default `true`) and holds the copy button — which flips to a\n * tick on click — with an optional `title` (e.g. a filename) on its left; `showLineNumbers` (default\n * `true`), `maxHeight` (scrolls inside) and `wrap` shape the body. The whole block\n * keeps VS Code's own dark colors (a deliberate literal-color exception, like the Modal scrim); only\n * the outer radius uses a `--tz-*` token (the border is a literal white-alpha hairline).\n */\nexport const CodeBlock = forwardRef<HTMLDivElement, CodeBlockProps>(function CodeBlock(\n {\n code,\n language = 'tsx',\n title,\n copyable = true,\n showLineNumbers = true,\n maxHeight,\n wrap = false,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const [html, setHtml] = useState<string | null>(null)\n const [copied, setCopied] = useState(false)\n const copyTimer = useRef<number | undefined>(undefined)\n\n // highlight asynchronously — shiki is an optional peer, loaded lazily on first use; a missing\n // package or an unknown language just leaves the plain (unhighlighted) fallback in place\n useEffect(() => {\n let cancelled = false\n import('shiki')\n .then(({ codeToHtml }) =>\n codeToHtml(code, {\n lang: language,\n // always VS Code's dark theme — the block stays dark in both app modes\n theme: 'dark-plus',\n }),\n )\n .then((out) => {\n if (!cancelled) setHtml(out)\n })\n .catch(() => {\n if (!cancelled) setHtml(null)\n })\n return () => {\n cancelled = true\n }\n }, [code, language])\n\n useEffect(() => () => window.clearTimeout(copyTimer.current), [])\n\n const handleCopy = () => {\n navigator.clipboard\n ?.writeText(code)\n .then(() => {\n setCopied(true)\n window.clearTimeout(copyTimer.current)\n copyTimer.current = window.setTimeout(() => setCopied(false), COPIED_RESET_MS)\n })\n .catch(() => {})\n }\n\n const copyButton = copyable && (\n // the tooltip is hover/focus-driven; clicking flips `copied`, so its content updates to \"Copied!\"\n // while it's still open (the pointer is on the button). `left` keeps it inside the block's\n // `overflow: hidden` bounds.\n <Tooltip\n content={copied ? t('codeBlock.copied') : t('codeBlock.copy')}\n placement=\"left\"\n // always a white pill with dark text over the (always-dark) block — set via `style` so it beats\n // Tooltip's own color-derived --tz-btn-rgb (which is spread before the consumer `style`)\n style={{ '--tz-btn-rgb': '255, 255, 255', '--tz-btn-on': '#1e1e1e' } as CSSProperties}\n >\n <IconButton\n variant=\"text\"\n size=\"sm\"\n className={styles.copy}\n // force the button light over the dark surface — passed via `style` so it beats IconButton's\n // own inline `--tz-btn-rgb` (which is spread before the consumer `style`, so this wins)\n style={{ '--tz-btn-rgb': '255, 255, 255' } as CSSProperties}\n aria-label={copied ? t('codeBlock.copied') : t('codeBlock.copy')}\n onClick={handleCopy}\n >\n <Icon name={copied ? 'CopySuccess' : 'Copy'} />\n </IconButton>\n </Tooltip>\n )\n\n return (\n <div ref={ref} className={clsx(styles.root, className)} style={style} {...props}>\n {/* the header bar always renders whenever there's a title or a copy button — so the copy icon\n lives in the bar (top-right), never floating over the code */}\n {(title != null || copyButton) && (\n <div className={styles.header}>\n <span className={styles.title}>{title}</span>\n {copyButton}\n </div>\n )}\n <div\n className={clsx(styles.code, wrap && styles.wrap, showLineNumbers && styles.lineNumbers)}\n style={maxHeight != null ? ({ maxHeight } as CSSProperties) : undefined}\n >\n {html != null ? (\n // shiki output is trusted markup — it escapes the source code itself\n <div className={styles.highlighted} dangerouslySetInnerHTML={{ __html: html }} />\n ) : (\n <pre className={styles.plain}>\n <code>{code}</code>\n </pre>\n )}\n </div>\n </div>\n )\n})\n"],"names":["COPIED_RESET_MS","CodeBlock","forwardRef","code","language","title","copyable","showLineNumbers","maxHeight","wrap","className","style","props","ref","t","useT","html","setHtml","useState","copied","setCopied","copyTimer","useRef","useEffect","cancelled","codeToHtml","out","handleCopy","_a","copyButton","jsx","Tooltip","IconButton","styles","Icon","jsxs","clsx"],"mappings":";;;;;;;;;;;;;;;;GAiBMA,IAAkB,MAmCXC,IAAYC,EAA2C,SAClE;AAAA,EACE,MAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,OAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,iBAAAC,IAAkB;AAAA,EAClB,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAIC,EAAA,GACJ,CAACC,GAAMC,CAAO,IAAIC,EAAwB,IAAI,GAC9C,CAACC,GAAQC,CAAS,IAAIF,EAAS,EAAK,GACpCG,IAAYC,EAA2B,MAAS;AAItD,EAAAC,EAAU,MAAM;AACd,QAAIC,IAAY;A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A;AAAA,IAC/C;AAAA,EAAA;AAIJ,SACE,gBAAAgB,EAAC,OAAA,EAAI,KAAAtB,GAAU,WAAWuB,EAAKH,EAAO,MAAMvB,CAAS,GAAG,OAAAC,GAAe,GAAGC,GAGtE,UAAA;AAAA,KAAAP,KAAS,QAAQwB,MACjB,gBAAAM,EAAC,OAAA,EAAI,WAAWF,EAAO,QACrB,UAAA;AAAA,MAAA,gBAAAH,EAAC,QAAA,EAAK,WAAWG,EAAO,OAAQ,UAAA5B,GAAM;AAAA,MACrCwB;AAAA,IAAA,GACH;AAAA,IAEF,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWM,EAAKH,EAAO,MAAMxB,KAAQwB,EAAO,MAAM1B,KAAmB0B,EAAO,WAAW;AAAA,QACvF,OAAOzB,KAAa,OAAQ,EAAE,WAAAA,MAAgC;AAAA,QAE7D,UAAAQ,KAAQ;AAAA;AAAA,UAEP,gBAAAc,EAAC,SAAI,WAAWG,EAAO,aAAa,yBAAyB,EAAE,QAAQjB,IAAK,CAAG;AAAA,YAE/E,gBAAAc,EAAC,SAAI,WAAWG,EAAO,OACrB,UAAA,gBAAAH,EAAC,QAAA,EAAM,aAAK,EAAA,CACd;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ,GACF;AAEJ,CAAC;"}
@@ -4,8 +4,8 @@ import { clsx as p } from "clsx";
4
4
  import { u as lr } from "./formContext-B7ln1Miy.js";
5
5
  import { F as sr } from "./FloatingPanel-C5c_eMQ0.js";
6
6
  import { T as j } from "./Typography-ChSuxgkc.js";
7
- import { p as tr, f as ar, s as e, C as ir } from "./ColorPickerPanel-CkrSIf35.js";
8
- import { a as nr } from "./ConfigProvider-DtyUlWk6.js";
7
+ import { p as tr, f as ar, s as e, C as ir } from "./ColorPickerPanel-CQNfIbgc.js";
8
+ import { a as nr } from "./ConfigProvider-bXX8dnhY.js";
9
9
  const cr = 232, Cr = er(function({
10
10
  label: u,
11
11
  size: H = "md",
@@ -125,4 +125,4 @@ const cr = 232, Cr = er(function({
125
125
  export {
126
126
  Cr as C
127
127
  };
128
- //# sourceMappingURL=ColorPicker-CwLivdAt.js.map
128
+ //# sourceMappingURL=ColorPicker-C4slmEZC.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker-CwLivdAt.js","sources":["../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { useT } from '../../theme'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { Typography } from '../Typography'\nimport { ColorPickerPanel } from './ColorPickerPanel'\nimport { formatColor, parseColor } from './colorUtils'\nimport styles from './ColorPicker.module.css'\n\nexport type ColorPickerSize = 'sm' | 'md' | 'lg'\n\n/** Popover width (px). */\nconst POPOVER_WIDTH = 232\n\nexport interface ColorPickerProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — control height, swatch and font. */\n size?: ColorPickerSize\n /** Marks the field invalid: red border/ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Disables the field. */\n disabled?: boolean\n /** Controlled value — a CSS color string: `#rrggbb` hex, or `rgba(r, g, b, a)` when translucent. */\n value?: string\n /** Initial value for uncontrolled use (hex or `rgb()`/`rgba()`). */\n defaultValue?: string\n /** Fires with the next color: `#rrggbb` when opaque, `rgba(r, g, b, a)` when not (or `''` when cleared). */\n onChange?: (color: string) => void\n /** Quick-pick swatches shown in the popover. Defaults to a curated palette. */\n swatches?: string[]\n /**\n * Offer opacity. Defaults to `true`. `false` hides the alpha slider and the field only ever emits\n * `#rrggbb` (never `rgba()`) — for colors that must be opaque, e.g. brand colors.\n */\n alpha?: boolean\n /** Form field name — auto-binds to a surrounding `<Form>` (value is the hex string). */\n name?: string\n /** Placeholder shown in the trigger when no color is set. Omit to show nothing. */\n placeholder?: string\n /** Id for the trigger (label association). */\n id?: string\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A color field with a beautiful popover picker: a saturation/value square, a hue slider, an alpha\n * (opacity) slider, a color input, quick-pick swatches and a clear button. The input accepts hex\n * (`#rgb`/`#rrggbb`/`#rrggbbaa`) or `rgb()`/`rgba()`, and the value comes back as `#rrggbb` when\n * fully opaque or `rgba(r, g, b, a)` when translucent. Clicking the trigger opens the popover, which\n * — like `Dropdown` — is portaled to `<body>`, opens below (flips above only when it would\n * overflow), locks page scroll and re-positions on scroll/resize. Controlled (`value` + `onChange`)\n * or uncontrolled (`defaultValue`), and binds to a surrounding `<Form>` by `name` (its form value is\n * the color string; validate with e.g. `z.string().regex(/^#[0-9a-f]{6}$/i, 'Pick a color')`, or a\n * looser pattern if you allow `rgba()`). Styling uses `--tz-*` tokens (the spectrum gradients and\n * the alpha checkerboard are the unavoidable exceptions).\n */\nexport const ColorPicker = forwardRef<HTMLButtonElement, ColorPickerProps>(function ColorPicker(\n {\n label,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n disabled = false,\n value,\n defaultValue,\n onChange,\n swatches,\n alpha = true,\n name,\n placeholder,\n id: idProp,\n className,\n style,\n },\n ref,\n) {\n const t = useT()\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n\n // Auto-bind to a surrounding <Form> by `name` — the form value is the hex string.\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue: string | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | undefined) ?? '')\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentColor = isControlled ? externalValue! : internal\n const parsed = parseColor(currentColor || '')\n // canonical string for the value (`#rrggbb` when opaque, `rgba(...)` when not), null when unset\n const displayValue = parsed ? formatColor(parsed) : null\n // hex shows uppercase in the trigger; rgba() stays as-is\n const displayText = displayValue\n ? displayValue[0] === '#'\n ? displayValue.toUpperCase()\n : displayValue\n : null\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const commit = (color: string) => {\n if (!isControlled) setInternal(color)\n if (isFormBound) form!.setValue(name!, color)\n onChange?.(color)\n }\n\n // ── popover (positioning / scroll-lock / dismiss come from FloatingPanel) ──────────────────────\n const triggerRef = useRef<HTMLButtonElement | null>(null)\n const popoverRef = useRef<HTMLDivElement | null>(null)\n const [open, setOpen] = useState(false)\n\n const setTriggerRef = useCallback(\n (node: HTMLButtonElement | null) => {\n triggerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLButtonElement | null }).current = node\n },\n [ref],\n )\n\n const closePopover = useCallback((refocus: boolean) => {\n setOpen(false)\n if (refocus) triggerRef.current?.focus()\n }, [])\n\n // mark the form field touched when focus leaves the whole widget — but not when it moves into the\n // (portaled) popover or stays on the trigger, so a form-bound picker shows its error like every\n // other popover field (Select/DatePicker) instead of only after submit\n const handleTriggerBlur = (event: FocusEvent<HTMLButtonElement>) => {\n const next = event.relatedTarget as Node | null\n if (next && (popoverRef.current?.contains(next) || triggerRef.current?.contains(next))) return\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n\n return (\n <div\n className={clsx(\n styles.field,\n styles[size],\n fullWidth && styles.fullWidth,\n resolvedError && styles.error,\n disabled && styles.disabled,\n className,\n )}\n style={style}\n >\n {label != null && (\n <label htmlFor={id} className={styles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <button\n ref={setTriggerRef}\n id={id}\n name={name}\n type=\"button\"\n className={clsx(styles.control, open && styles.open)}\n disabled={disabled}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n aria-label={label || parsed || placeholder ? undefined : t('colorPicker.pick')}\n onClick={() => setOpen((o) => !o)}\n onBlur={handleTriggerBlur}\n >\n <span className={clsx(styles.value, !parsed && styles.placeholder)}>\n {displayText ?? placeholder}\n </span>\n <span\n className={clsx(styles.preview, !parsed && styles.previewEmpty)}\n style={parsed ? ({ '--cp-fill': displayValue } as CSSProperties) : undefined}\n aria-hidden=\"true\"\n />\n </button>\n\n <FloatingPanel\n ref={popoverRef}\n open={open}\n triggerRef={triggerRef}\n onClose={closePopover}\n role=\"dialog\"\n ariaLabel={t('colorPicker.dialog')}\n width={POPOVER_WIDTH}\n >\n <ColorPickerPanel\n value={currentColor}\n onChange={commit}\n swatches={swatches}\n alpha={alpha}\n />\n </FloatingPanel>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={styles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["POPOVER_WIDTH","ColorPicker","forwardRef","label","size","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","swatches","alpha","name","placeholder","idProp","className","style","ref","t","useT","reactId","useId","id","helperId","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentColor","parsed","parseColor","displayValue","formatColor","displayText","resolvedError","resolvedHelperText","commit","color","triggerRef","useRef","popoverRef","open","setOpen","setTriggerRef","useCallback","node","closePopover","refocus","_a","handleTriggerBlur","event","next","_b","jsxs","clsx","styles","jsx","Typography","o","FloatingPanel","ColorPickerPanel"],"mappings":";;;;;;;;AAsBA,MAAMA,KAAgB,KAoDTC,KAAcC,GAAgD,SACzE;AAAA,EACE,OAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,YAAAC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AC;"}
1
+ {"version":3,"file":"ColorPicker-C4slmEZC.js","sources":["../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { useT } from '../../theme'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { Typography } from '../Typography'\nimport { ColorPickerPanel } from './ColorPickerPanel'\nimport { formatColor, parseColor } from './colorUtils'\nimport styles from './ColorPicker.module.css'\n\nexport type ColorPickerSize = 'sm' | 'md' | 'lg'\n\n/** Popover width (px). */\nconst POPOVER_WIDTH = 232\n\nexport interface ColorPickerProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — control height, swatch and font. */\n size?: ColorPickerSize\n /** Marks the field invalid: red border/ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Disables the field. */\n disabled?: boolean\n /** Controlled value — a CSS color string: `#rrggbb` hex, or `rgba(r, g, b, a)` when translucent. */\n value?: string\n /** Initial value for uncontrolled use (hex or `rgb()`/`rgba()`). */\n defaultValue?: string\n /** Fires with the next color: `#rrggbb` when opaque, `rgba(r, g, b, a)` when not (or `''` when cleared). */\n onChange?: (color: string) => void\n /** Quick-pick swatches shown in the popover. Defaults to a curated palette. */\n swatches?: string[]\n /**\n * Offer opacity. Defaults to `true`. `false` hides the alpha slider and the field only ever emits\n * `#rrggbb` (never `rgba()`) — for colors that must be opaque, e.g. brand colors.\n */\n alpha?: boolean\n /** Form field name — auto-binds to a surrounding `<Form>` (value is the hex string). */\n name?: string\n /** Placeholder shown in the trigger when no color is set. Omit to show nothing. */\n placeholder?: string\n /** Id for the trigger (label association). */\n id?: string\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A color field with a beautiful popover picker: a saturation/value square, a hue slider, an alpha\n * (opacity) slider, a color input, quick-pick swatches and a clear button. The input accepts hex\n * (`#rgb`/`#rrggbb`/`#rrggbbaa`) or `rgb()`/`rgba()`, and the value comes back as `#rrggbb` when\n * fully opaque or `rgba(r, g, b, a)` when translucent. Clicking the trigger opens the popover, which\n * — like `Dropdown` — is portaled to `<body>`, opens below (flips above only when it would\n * overflow), locks page scroll and re-positions on scroll/resize. Controlled (`value` + `onChange`)\n * or uncontrolled (`defaultValue`), and binds to a surrounding `<Form>` by `name` (its form value is\n * the color string; validate with e.g. `z.string().regex(/^#[0-9a-f]{6}$/i, 'Pick a color')`, or a\n * looser pattern if you allow `rgba()`). Styling uses `--tz-*` tokens (the spectrum gradients and\n * the alpha checkerboard are the unavoidable exceptions).\n */\nexport const ColorPicker = forwardRef<HTMLButtonElement, ColorPickerProps>(function ColorPicker(\n {\n label,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n disabled = false,\n value,\n defaultValue,\n onChange,\n swatches,\n alpha = true,\n name,\n placeholder,\n id: idProp,\n className,\n style,\n },\n ref,\n) {\n const t = useT()\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n\n // Auto-bind to a surrounding <Form> by `name` — the form value is the hex string.\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue: string | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | undefined) ?? '')\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentColor = isControlled ? externalValue! : internal\n const parsed = parseColor(currentColor || '')\n // canonical string for the value (`#rrggbb` when opaque, `rgba(...)` when not), null when unset\n const displayValue = parsed ? formatColor(parsed) : null\n // hex shows uppercase in the trigger; rgba() stays as-is\n const displayText = displayValue\n ? displayValue[0] === '#'\n ? displayValue.toUpperCase()\n : displayValue\n : null\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const commit = (color: string) => {\n if (!isControlled) setInternal(color)\n if (isFormBound) form!.setValue(name!, color)\n onChange?.(color)\n }\n\n // ── popover (positioning / scroll-lock / dismiss come from FloatingPanel) ──────────────────────\n const triggerRef = useRef<HTMLButtonElement | null>(null)\n const popoverRef = useRef<HTMLDivElement | null>(null)\n const [open, setOpen] = useState(false)\n\n const setTriggerRef = useCallback(\n (node: HTMLButtonElement | null) => {\n triggerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLButtonElement | null }).current = node\n },\n [ref],\n )\n\n const closePopover = useCallback((refocus: boolean) => {\n setOpen(false)\n if (refocus) triggerRef.current?.focus()\n }, [])\n\n // mark the form field touched when focus leaves the whole widget — but not when it moves into the\n // (portaled) popover or stays on the trigger, so a form-bound picker shows its error like every\n // other popover field (Select/DatePicker) instead of only after submit\n const handleTriggerBlur = (event: FocusEvent<HTMLButtonElement>) => {\n const next = event.relatedTarget as Node | null\n if (next && (popoverRef.current?.contains(next) || triggerRef.current?.contains(next))) return\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n\n return (\n <div\n className={clsx(\n styles.field,\n styles[size],\n fullWidth && styles.fullWidth,\n resolvedError && styles.error,\n disabled && styles.disabled,\n className,\n )}\n style={style}\n >\n {label != null && (\n <label htmlFor={id} className={styles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <button\n ref={setTriggerRef}\n id={id}\n name={name}\n type=\"button\"\n className={clsx(styles.control, open && styles.open)}\n disabled={disabled}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n aria-label={label || parsed || placeholder ? undefined : t('colorPicker.pick')}\n onClick={() => setOpen((o) => !o)}\n onBlur={handleTriggerBlur}\n >\n <span className={clsx(styles.value, !parsed && styles.placeholder)}>\n {displayText ?? placeholder}\n </span>\n <span\n className={clsx(styles.preview, !parsed && styles.previewEmpty)}\n style={parsed ? ({ '--cp-fill': displayValue } as CSSProperties) : undefined}\n aria-hidden=\"true\"\n />\n </button>\n\n <FloatingPanel\n ref={popoverRef}\n open={open}\n triggerRef={triggerRef}\n onClose={closePopover}\n role=\"dialog\"\n ariaLabel={t('colorPicker.dialog')}\n width={POPOVER_WIDTH}\n >\n <ColorPickerPanel\n value={currentColor}\n onChange={commit}\n swatches={swatches}\n alpha={alpha}\n />\n </FloatingPanel>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={styles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["POPOVER_WIDTH","ColorPicker","forwardRef","label","size","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","swatches","alpha","name","placeholder","idProp","className","style","ref","t","useT","reactId","useId","id","helperId","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentColor","parsed","parseColor","displayValue","formatColor","displayText","resolvedError","resolvedHelperText","commit","color","triggerRef","useRef","popoverRef","open","setOpen","setTriggerRef","useCallback","node","closePopover","refocus","_a","handleTriggerBlur","event","next","_b","jsxs","clsx","styles","jsx","Typography","o","FloatingPanel","ColorPickerPanel"],"mappings":";;;;;;;;AAsBA,MAAMA,KAAgB,KAoDTC,KAAcC,GAAgD,SACzE;AAAA,EACE,OAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAA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,SAAS,MAAM6B,EAAQ,CAACgB,MAAM,CAACA,CAAC;AAAA,YAChC,QAAQT;AAAA,YAER,UAAA;AAAA,cAAA,gBAAAO,EAAC,QAAA,EAAK,WAAWF,EAAKC,EAAO,OAAO,CAAC1B,KAAU0B,EAAO,WAAW,GAC9D,UAAAtB,KAAezB,EAAA,CAClB;AAAA,cACA,gBAAAgD;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAWF,EAAKC,EAAO,SAAS,CAAC1B,KAAU0B,EAAO,YAAY;AAAA,kBAC9D,OAAO1B,IAAU,EAAE,aAAaE,MAAmC;AAAA,kBACnE,eAAY;AAAA,gBAAA;AAAA,cAAA;AAAA,YACd;AAAA,UAAA;AAAA,QAAA;AAAA,QAGF,gBAAAyB;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,KAAKnB;AAAA,YACL,MAAAC;AAAA,YACA,YAAAH;AAAA,YACA,SAASQ;AAAA,YACT,MAAK;AAAA,YACL,WAAWjC,EAAE,oBAAoB;AAAA,YACjC,OAAOrB;AAAA,YAEP,UAAA,gBAAAgE;AAAA,cAACI;AAAA,cAAA;AAAA,gBACC,OAAOhC;AAAA,gBACP,UAAUQ;AAAA,gBACV,UAAA/B;AAAA,gBACA,OAAAC;AAAA,cAAA;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,QAGD6B,KAAsB,QACrB,gBAAAqB;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAIvC;AAAA,YACJ,SAAQ;AAAA,YACR,OAAOgB,IAAgB,UAAU;AAAA,YACjC,WAAWqB,EAAO;AAAA,YAEjB,UAAApB;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
@@ -1,2 +1,2 @@
1
- "use strict";const r=require("react/jsx-runtime"),t=require("react"),p=require("clsx"),Y=require("./formContext-bTWrqdEV.cjs"),Z=require("./FloatingPanel-tGCG2nhA.cjs"),w=require("./Typography-d97DdbNd.cjs"),e=require("./ColorPickerPanel-IOhJJF1R.cjs"),ee=require("./ConfigProvider-CYSpuSMJ.cjs"),se=232,re=t.forwardRef(function({label:y,size:S="md",error:V,helperText:E,required:O=!1,fullWidth:H=!0,disabled:P=!1,value:C,defaultValue:W,onChange:f,swatches:D,alpha:L=!0,name:o,placeholder:g,id:U,className:_,style:$},a){const j=ee.useT(),z=t.useId(),x=U??z,k=`${x}-helper`,c=Y.useFormContext(),T=!!(c&&o),l=c&&o?c.field(o):void 0,q=C!==void 0?C:T?c.values[o]??"":void 0,R=q!==void 0,[A,G]=t.useState(W??""),N=R?q:A,i=e.parseColor(N||""),u=i?e.formatColor(i):null,J=u?u[0]==="#"?u.toUpperCase():u:null,v=V??(l==null?void 0:l.error)??!1,h=E??(l==null?void 0:l.helperText),K=s=>{R||G(s),T&&c.setValue(o,s),f==null||f(s)},d=t.useRef(null),b=t.useRef(null),[m,B]=t.useState(!1),M=t.useCallback(s=>{d.current=s,typeof a=="function"?a(s):a&&(a.current=s)},[a]),Q=t.useCallback(s=>{var n;B(!1),s&&((n=d.current)==null||n.focus())},[]),X=s=>{var F,I;const n=s.relatedTarget;n&&((F=b.current)!=null&&F.contains(n)||(I=d.current)!=null&&I.contains(n))||l==null||l.onBlur(s)};return r.jsxs("div",{className:p.clsx(e.styles.field,e.styles[S],H&&e.styles.fullWidth,v&&e.styles.error,P&&e.styles.disabled,_),style:$,children:[y!=null&&r.jsxs("label",{htmlFor:x,className:e.styles.label,children:[r.jsx(w.Typography,{as:"span",variant:"bodySmall",color:"muted",children:y}),O&&r.jsx("span",{className:e.styles.required,"aria-hidden":"true",children:"*"})]}),r.jsxs("button",{ref:M,id:x,name:o,type:"button",className:p.clsx(e.styles.control,m&&e.styles.open),disabled:P,"aria-haspopup":"dialog","aria-expanded":m,"aria-invalid":v||void 0,"aria-describedby":h!=null?k:void 0,"aria-label":y||i||g?void 0:j("colorPicker.pick"),onClick:()=>B(s=>!s),onBlur:X,children:[r.jsx("span",{className:p.clsx(e.styles.value,!i&&e.styles.placeholder),children:J??g}),r.jsx("span",{className:p.clsx(e.styles.preview,!i&&e.styles.previewEmpty),style:i?{"--cp-fill":u}:void 0,"aria-hidden":"true"})]}),r.jsx(Z.FloatingPanel,{ref:b,open:m,triggerRef:d,onClose:Q,role:"dialog",ariaLabel:j("colorPicker.dialog"),width:se,children:r.jsx(e.ColorPickerPanel,{value:N,onChange:K,swatches:D,alpha:L})}),h!=null&&r.jsx(w.Typography,{as:"span",id:k,variant:"bodySmall",color:v?"error":"muted",className:e.styles.helper,children:h})]})});exports.ColorPicker=re;
2
- //# sourceMappingURL=ColorPicker-BaAdcqR9.cjs.map
1
+ "use strict";const r=require("react/jsx-runtime"),t=require("react"),p=require("clsx"),Y=require("./formContext-bTWrqdEV.cjs"),Z=require("./FloatingPanel-tGCG2nhA.cjs"),w=require("./Typography-d97DdbNd.cjs"),e=require("./ColorPickerPanel-CNspBZre.cjs"),ee=require("./ConfigProvider-BFhkb0BV.cjs"),se=232,re=t.forwardRef(function({label:y,size:S="md",error:V,helperText:E,required:O=!1,fullWidth:H=!0,disabled:P=!1,value:C,defaultValue:W,onChange:f,swatches:D,alpha:L=!0,name:o,placeholder:g,id:U,className:_,style:$},a){const j=ee.useT(),z=t.useId(),x=U??z,k=`${x}-helper`,c=Y.useFormContext(),T=!!(c&&o),l=c&&o?c.field(o):void 0,q=C!==void 0?C:T?c.values[o]??"":void 0,R=q!==void 0,[A,G]=t.useState(W??""),N=R?q:A,i=e.parseColor(N||""),u=i?e.formatColor(i):null,J=u?u[0]==="#"?u.toUpperCase():u:null,v=V??(l==null?void 0:l.error)??!1,h=E??(l==null?void 0:l.helperText),K=s=>{R||G(s),T&&c.setValue(o,s),f==null||f(s)},d=t.useRef(null),b=t.useRef(null),[m,B]=t.useState(!1),M=t.useCallback(s=>{d.current=s,typeof a=="function"?a(s):a&&(a.current=s)},[a]),Q=t.useCallback(s=>{var n;B(!1),s&&((n=d.current)==null||n.focus())},[]),X=s=>{var F,I;const n=s.relatedTarget;n&&((F=b.current)!=null&&F.contains(n)||(I=d.current)!=null&&I.contains(n))||l==null||l.onBlur(s)};return r.jsxs("div",{className:p.clsx(e.styles.field,e.styles[S],H&&e.styles.fullWidth,v&&e.styles.error,P&&e.styles.disabled,_),style:$,children:[y!=null&&r.jsxs("label",{htmlFor:x,className:e.styles.label,children:[r.jsx(w.Typography,{as:"span",variant:"bodySmall",color:"muted",children:y}),O&&r.jsx("span",{className:e.styles.required,"aria-hidden":"true",children:"*"})]}),r.jsxs("button",{ref:M,id:x,name:o,type:"button",className:p.clsx(e.styles.control,m&&e.styles.open),disabled:P,"aria-haspopup":"dialog","aria-expanded":m,"aria-invalid":v||void 0,"aria-describedby":h!=null?k:void 0,"aria-label":y||i||g?void 0:j("colorPicker.pick"),onClick:()=>B(s=>!s),onBlur:X,children:[r.jsx("span",{className:p.clsx(e.styles.value,!i&&e.styles.placeholder),children:J??g}),r.jsx("span",{className:p.clsx(e.styles.preview,!i&&e.styles.previewEmpty),style:i?{"--cp-fill":u}:void 0,"aria-hidden":"true"})]}),r.jsx(Z.FloatingPanel,{ref:b,open:m,triggerRef:d,onClose:Q,role:"dialog",ariaLabel:j("colorPicker.dialog"),width:se,children:r.jsx(e.ColorPickerPanel,{value:N,onChange:K,swatches:D,alpha:L})}),h!=null&&r.jsx(w.Typography,{as:"span",id:k,variant:"bodySmall",color:v?"error":"muted",className:e.styles.helper,children:h})]})});exports.ColorPicker=re;
2
+ //# sourceMappingURL=ColorPicker-_RBW51XB.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker-BaAdcqR9.cjs","sources":["../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { useT } from '../../theme'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { Typography } from '../Typography'\nimport { ColorPickerPanel } from './ColorPickerPanel'\nimport { formatColor, parseColor } from './colorUtils'\nimport styles from './ColorPicker.module.css'\n\nexport type ColorPickerSize = 'sm' | 'md' | 'lg'\n\n/** Popover width (px). */\nconst POPOVER_WIDTH = 232\n\nexport interface ColorPickerProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — control height, swatch and font. */\n size?: ColorPickerSize\n /** Marks the field invalid: red border/ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Disables the field. */\n disabled?: boolean\n /** Controlled value — a CSS color string: `#rrggbb` hex, or `rgba(r, g, b, a)` when translucent. */\n value?: string\n /** Initial value for uncontrolled use (hex or `rgb()`/`rgba()`). */\n defaultValue?: string\n /** Fires with the next color: `#rrggbb` when opaque, `rgba(r, g, b, a)` when not (or `''` when cleared). */\n onChange?: (color: string) => void\n /** Quick-pick swatches shown in the popover. Defaults to a curated palette. */\n swatches?: string[]\n /**\n * Offer opacity. Defaults to `true`. `false` hides the alpha slider and the field only ever emits\n * `#rrggbb` (never `rgba()`) — for colors that must be opaque, e.g. brand colors.\n */\n alpha?: boolean\n /** Form field name — auto-binds to a surrounding `<Form>` (value is the hex string). */\n name?: string\n /** Placeholder shown in the trigger when no color is set. Omit to show nothing. */\n placeholder?: string\n /** Id for the trigger (label association). */\n id?: string\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A color field with a beautiful popover picker: a saturation/value square, a hue slider, an alpha\n * (opacity) slider, a color input, quick-pick swatches and a clear button. The input accepts hex\n * (`#rgb`/`#rrggbb`/`#rrggbbaa`) or `rgb()`/`rgba()`, and the value comes back as `#rrggbb` when\n * fully opaque or `rgba(r, g, b, a)` when translucent. Clicking the trigger opens the popover, which\n * — like `Dropdown` — is portaled to `<body>`, opens below (flips above only when it would\n * overflow), locks page scroll and re-positions on scroll/resize. Controlled (`value` + `onChange`)\n * or uncontrolled (`defaultValue`), and binds to a surrounding `<Form>` by `name` (its form value is\n * the color string; validate with e.g. `z.string().regex(/^#[0-9a-f]{6}$/i, 'Pick a color')`, or a\n * looser pattern if you allow `rgba()`). Styling uses `--tz-*` tokens (the spectrum gradients and\n * the alpha checkerboard are the unavoidable exceptions).\n */\nexport const ColorPicker = forwardRef<HTMLButtonElement, ColorPickerProps>(function ColorPicker(\n {\n label,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n disabled = false,\n value,\n defaultValue,\n onChange,\n swatches,\n alpha = true,\n name,\n placeholder,\n id: idProp,\n className,\n style,\n },\n ref,\n) {\n const t = useT()\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n\n // Auto-bind to a surrounding <Form> by `name` — the form value is the hex string.\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue: string | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | undefined) ?? '')\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentColor = isControlled ? externalValue! : internal\n const parsed = parseColor(currentColor || '')\n // canonical string for the value (`#rrggbb` when opaque, `rgba(...)` when not), null when unset\n const displayValue = parsed ? formatColor(parsed) : null\n // hex shows uppercase in the trigger; rgba() stays as-is\n const displayText = displayValue\n ? displayValue[0] === '#'\n ? displayValue.toUpperCase()\n : displayValue\n : null\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const commit = (color: string) => {\n if (!isControlled) setInternal(color)\n if (isFormBound) form!.setValue(name!, color)\n onChange?.(color)\n }\n\n // ── popover (positioning / scroll-lock / dismiss come from FloatingPanel) ──────────────────────\n const triggerRef = useRef<HTMLButtonElement | null>(null)\n const popoverRef = useRef<HTMLDivElement | null>(null)\n const [open, setOpen] = useState(false)\n\n const setTriggerRef = useCallback(\n (node: HTMLButtonElement | null) => {\n triggerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLButtonElement | null }).current = node\n },\n [ref],\n )\n\n const closePopover = useCallback((refocus: boolean) => {\n setOpen(false)\n if (refocus) triggerRef.current?.focus()\n }, [])\n\n // mark the form field touched when focus leaves the whole widget — but not when it moves into the\n // (portaled) popover or stays on the trigger, so a form-bound picker shows its error like every\n // other popover field (Select/DatePicker) instead of only after submit\n const handleTriggerBlur = (event: FocusEvent<HTMLButtonElement>) => {\n const next = event.relatedTarget as Node | null\n if (next && (popoverRef.current?.contains(next) || triggerRef.current?.contains(next))) return\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n\n return (\n <div\n className={clsx(\n styles.field,\n styles[size],\n fullWidth && styles.fullWidth,\n resolvedError && styles.error,\n disabled && styles.disabled,\n className,\n )}\n style={style}\n >\n {label != null && (\n <label htmlFor={id} className={styles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <button\n ref={setTriggerRef}\n id={id}\n name={name}\n type=\"button\"\n className={clsx(styles.control, open && styles.open)}\n disabled={disabled}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n aria-label={label || parsed || placeholder ? undefined : t('colorPicker.pick')}\n onClick={() => setOpen((o) => !o)}\n onBlur={handleTriggerBlur}\n >\n <span className={clsx(styles.value, !parsed && styles.placeholder)}>\n {displayText ?? placeholder}\n </span>\n <span\n className={clsx(styles.preview, !parsed && styles.previewEmpty)}\n style={parsed ? ({ '--cp-fill': displayValue } as CSSProperties) : undefined}\n aria-hidden=\"true\"\n />\n </button>\n\n <FloatingPanel\n ref={popoverRef}\n open={open}\n triggerRef={triggerRef}\n onClose={closePopover}\n role=\"dialog\"\n ariaLabel={t('colorPicker.dialog')}\n width={POPOVER_WIDTH}\n >\n <ColorPickerPanel\n value={currentColor}\n onChange={commit}\n swatches={swatches}\n alpha={alpha}\n />\n </FloatingPanel>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={styles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["POPOVER_WIDTH","ColorPicker","forwardRef","label","size","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","swatches","alpha","name","placeholder","idProp","className","style","ref","t","useT","reactId","useId","id","helperId","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentColor","parsed","parseColor","displayValue","formatColor","displayText","resolvedError","resolvedHelperText","commit","color","triggerRef","useRef","popoverRef","open","setOpen","setTriggerRef","useCallback","node","closePopover","refocus","_a","handleTriggerBlur","event","next","_b","jsxs","clsx","styles","jsx","Typography","o","FloatingPanel","ColorPickerPanel"],"mappings":"ySAsBMA,GAAgB,IAoDTC,GAAcC,EAAAA,WAAgD,SACzE,CACE,MAAAC,EACA,KAAAC,EAAO,KACP,MAAAC,EACA,WAAAC,EACA,SAAAC,EAAW,GACX,UAAAC,EAAY,GACZ,SAAAC,EAAW,GACX,MAAAC,EACA,aAAAC,EACA,SAAAC,EACA,SAAAC,EACA,MAAAC,EAAQ,GACR,KAAAC,EACA,YAAAC,EACA,GAAIC,EACJ,UAAAC,EACA,MAAAC,CACF,EACAC,EACA,CACA,MAAMC,EAAIC,GAAAA,KAAA,EACJC,EAAUC,EAAAA,MAAA,EACVC,EAAKR,GAAUM,EACfG,EAAW,GAAGD,CAAE,UAGhBE,EAAOC,EAAAA,eAAA,EACPC,EAAc,GAAQF,GAAQZ,GAC9Be,EAAQH,GAAQZ,EAAOY,EAAK,MAAMZ,CAAI,EAAI,OAE1CgB,EAC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EAAE,oBAAoB,EACjC,MAAOrB,GAEP,SAAAgE,EAAAA,IAACI,EAAAA,iBAAA,CACC,MAAOhC,EACP,SAAUQ,EACV,SAAA/B,EACA,MAAAC,CAAA,CAAA,CACF,CAAA,EAGD6B,GAAsB,MACrBqB,EAAAA,IAACC,EAAAA,WAAA,CACC,GAAG,OACH,GAAIvC,EACJ,QAAQ,YACR,MAAOgB,EAAgB,QAAU,QACjC,UAAWqB,EAAAA,OAAO,OAEjB,SAAApB,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,CAAC"}
1
+ {"version":3,"file":"ColorPicker-_RBW51XB.cjs","sources":["../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { useT } from '../../theme'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { Typography } from '../Typography'\nimport { ColorPickerPanel } from './ColorPickerPanel'\nimport { formatColor, parseColor } from './colorUtils'\nimport styles from './ColorPicker.module.css'\n\nexport type ColorPickerSize = 'sm' | 'md' | 'lg'\n\n/** Popover width (px). */\nconst POPOVER_WIDTH = 232\n\nexport interface ColorPickerProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — control height, swatch and font. */\n size?: ColorPickerSize\n /** Marks the field invalid: red border/ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Disables the field. */\n disabled?: boolean\n /** Controlled value — a CSS color string: `#rrggbb` hex, or `rgba(r, g, b, a)` when translucent. */\n value?: string\n /** Initial value for uncontrolled use (hex or `rgb()`/`rgba()`). */\n defaultValue?: string\n /** Fires with the next color: `#rrggbb` when opaque, `rgba(r, g, b, a)` when not (or `''` when cleared). */\n onChange?: (color: string) => void\n /** Quick-pick swatches shown in the popover. Defaults to a curated palette. */\n swatches?: string[]\n /**\n * Offer opacity. Defaults to `true`. `false` hides the alpha slider and the field only ever emits\n * `#rrggbb` (never `rgba()`) — for colors that must be opaque, e.g. brand colors.\n */\n alpha?: boolean\n /** Form field name — auto-binds to a surrounding `<Form>` (value is the hex string). */\n name?: string\n /** Placeholder shown in the trigger when no color is set. Omit to show nothing. */\n placeholder?: string\n /** Id for the trigger (label association). */\n id?: string\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A color field with a beautiful popover picker: a saturation/value square, a hue slider, an alpha\n * (opacity) slider, a color input, quick-pick swatches and a clear button. The input accepts hex\n * (`#rgb`/`#rrggbb`/`#rrggbbaa`) or `rgb()`/`rgba()`, and the value comes back as `#rrggbb` when\n * fully opaque or `rgba(r, g, b, a)` when translucent. Clicking the trigger opens the popover, which\n * — like `Dropdown` — is portaled to `<body>`, opens below (flips above only when it would\n * overflow), locks page scroll and re-positions on scroll/resize. Controlled (`value` + `onChange`)\n * or uncontrolled (`defaultValue`), and binds to a surrounding `<Form>` by `name` (its form value is\n * the color string; validate with e.g. `z.string().regex(/^#[0-9a-f]{6}$/i, 'Pick a color')`, or a\n * looser pattern if you allow `rgba()`). Styling uses `--tz-*` tokens (the spectrum gradients and\n * the alpha checkerboard are the unavoidable exceptions).\n */\nexport const ColorPicker = forwardRef<HTMLButtonElement, ColorPickerProps>(function ColorPicker(\n {\n label,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n disabled = false,\n value,\n defaultValue,\n onChange,\n swatches,\n alpha = true,\n name,\n placeholder,\n id: idProp,\n className,\n style,\n },\n ref,\n) {\n const t = useT()\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n\n // Auto-bind to a surrounding <Form> by `name` — the form value is the hex string.\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue: string | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | undefined) ?? '')\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentColor = isControlled ? externalValue! : internal\n const parsed = parseColor(currentColor || '')\n // canonical string for the value (`#rrggbb` when opaque, `rgba(...)` when not), null when unset\n const displayValue = parsed ? formatColor(parsed) : null\n // hex shows uppercase in the trigger; rgba() stays as-is\n const displayText = displayValue\n ? displayValue[0] === '#'\n ? displayValue.toUpperCase()\n : displayValue\n : null\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const commit = (color: string) => {\n if (!isControlled) setInternal(color)\n if (isFormBound) form!.setValue(name!, color)\n onChange?.(color)\n }\n\n // ── popover (positioning / scroll-lock / dismiss come from FloatingPanel) ──────────────────────\n const triggerRef = useRef<HTMLButtonElement | null>(null)\n const popoverRef = useRef<HTMLDivElement | null>(null)\n const [open, setOpen] = useState(false)\n\n const setTriggerRef = useCallback(\n (node: HTMLButtonElement | null) => {\n triggerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLButtonElement | null }).current = node\n },\n [ref],\n )\n\n const closePopover = useCallback((refocus: boolean) => {\n setOpen(false)\n if (refocus) triggerRef.current?.focus()\n }, [])\n\n // mark the form field touched when focus leaves the whole widget — but not when it moves into the\n // (portaled) popover or stays on the trigger, so a form-bound picker shows its error like every\n // other popover field (Select/DatePicker) instead of only after submit\n const handleTriggerBlur = (event: FocusEvent<HTMLButtonElement>) => {\n const next = event.relatedTarget as Node | null\n if (next && (popoverRef.current?.contains(next) || triggerRef.current?.contains(next))) return\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n\n return (\n <div\n className={clsx(\n styles.field,\n styles[size],\n fullWidth && styles.fullWidth,\n resolvedError && styles.error,\n disabled && styles.disabled,\n className,\n )}\n style={style}\n >\n {label != null && (\n <label htmlFor={id} className={styles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <button\n ref={setTriggerRef}\n id={id}\n name={name}\n type=\"button\"\n className={clsx(styles.control, open && styles.open)}\n disabled={disabled}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n aria-label={label || parsed || placeholder ? undefined : t('colorPicker.pick')}\n onClick={() => setOpen((o) => !o)}\n onBlur={handleTriggerBlur}\n >\n <span className={clsx(styles.value, !parsed && styles.placeholder)}>\n {displayText ?? placeholder}\n </span>\n <span\n className={clsx(styles.preview, !parsed && styles.previewEmpty)}\n style={parsed ? ({ '--cp-fill': displayValue } as CSSProperties) : undefined}\n aria-hidden=\"true\"\n />\n </button>\n\n <FloatingPanel\n ref={popoverRef}\n open={open}\n triggerRef={triggerRef}\n onClose={closePopover}\n role=\"dialog\"\n ariaLabel={t('colorPicker.dialog')}\n width={POPOVER_WIDTH}\n >\n <ColorPickerPanel\n value={currentColor}\n onChange={commit}\n swatches={swatches}\n alpha={alpha}\n />\n </FloatingPanel>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={styles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["POPOVER_WIDTH","ColorPicker","forwardRef","label","size","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","swatches","alpha","name","placeholder","idProp","className","style","ref","t","useT","reactId","useId","id","helperId","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentColor","parsed","parseColor","displayValue","formatColor","displayText","resolvedError","resolvedHelperText","commit","color","triggerRef","useRef","popoverRef","open","setOpen","setTriggerRef","useCallback","node","closePopover","refocus","_a","handleTriggerBlur","event","next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