@techzyapp/ui-library 1.0.20 → 1.0.21

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 (377) hide show
  1. package/dist/{Accordion-Dy_dM79Y.cjs → Accordion-P3PNqSER.cjs} +2 -2
  2. package/dist/{Accordion-Dy_dM79Y.cjs.map → Accordion-P3PNqSER.cjs.map} +1 -1
  3. package/dist/{Accordion-CAxa1I-m.js → Accordion-w-w_WxxV.js} +3 -3
  4. package/dist/{Accordion-CAxa1I-m.js.map → Accordion-w-w_WxxV.js.map} +1 -1
  5. package/dist/{AdminRoot-DlpMJNTx.cjs → AdminRoot-BDRLuMX6.cjs} +2 -2
  6. package/dist/{AdminRoot-DlpMJNTx.cjs.map → AdminRoot-BDRLuMX6.cjs.map} +1 -1
  7. package/dist/{AdminRoot-B2J1cHK5.js → AdminRoot-DvF0js0q.js} +4 -4
  8. package/dist/{AdminRoot-B2J1cHK5.js.map → AdminRoot-DvF0js0q.js.map} +1 -1
  9. package/dist/{Alert-DRZdNwDm.cjs → Alert-CwoRkKq4.cjs} +2 -2
  10. package/dist/{Alert-DRZdNwDm.cjs.map → Alert-CwoRkKq4.cjs.map} +1 -1
  11. package/dist/{Alert-yldGvhVM.js → Alert-DPYmdaWs.js} +5 -5
  12. package/dist/{Alert-yldGvhVM.js.map → Alert-DPYmdaWs.js.map} +1 -1
  13. package/dist/{AuthLayout-B1tzhzHo.cjs → AuthLayout-BRUxDgzs.cjs} +2 -2
  14. package/dist/{AuthLayout-B1tzhzHo.cjs.map → AuthLayout-BRUxDgzs.cjs.map} +1 -1
  15. package/dist/{AuthLayout-j7EAPPXT.js → AuthLayout-CP9qu6Bv.js} +2 -2
  16. package/dist/{AuthLayout-j7EAPPXT.js.map → AuthLayout-CP9qu6Bv.js.map} +1 -1
  17. package/dist/{Avatar-_ufXh3AY.cjs → Avatar-Dgf04PBC.cjs} +2 -2
  18. package/dist/{Avatar-_ufXh3AY.cjs.map → Avatar-Dgf04PBC.cjs.map} +1 -1
  19. package/dist/{Avatar-BJVCdo-K.js → Avatar-Q50J8wdN.js} +3 -3
  20. package/dist/{Avatar-BJVCdo-K.js.map → Avatar-Q50J8wdN.js.map} +1 -1
  21. package/dist/{AvatarGroup-DdJf4aT7.js → AvatarGroup-YaNasLMS.js} +2 -2
  22. package/dist/{AvatarGroup-DdJf4aT7.js.map → AvatarGroup-YaNasLMS.js.map} +1 -1
  23. package/dist/{AvatarGroup-TW1pt4tj.cjs → AvatarGroup-uW0SD5P4.cjs} +2 -2
  24. package/dist/{AvatarGroup-TW1pt4tj.cjs.map → AvatarGroup-uW0SD5P4.cjs.map} +1 -1
  25. package/dist/{Breadcrumbs-f0GE4lCI.cjs → Breadcrumbs-CknDBLMw.cjs} +2 -2
  26. package/dist/{Breadcrumbs-f0GE4lCI.cjs.map → Breadcrumbs-CknDBLMw.cjs.map} +1 -1
  27. package/dist/{Breadcrumbs-FpIOHx_q.js → Breadcrumbs-l0PlUpQ4.js} +5 -5
  28. package/dist/{Breadcrumbs-FpIOHx_q.js.map → Breadcrumbs-l0PlUpQ4.js.map} +1 -1
  29. package/dist/{Button-Cu0XdnW6.cjs → Button-BdihbLYJ.cjs} +2 -2
  30. package/dist/{Button-Cu0XdnW6.cjs.map → Button-BdihbLYJ.cjs.map} +1 -1
  31. package/dist/{Button-BkjZ7wEu.js → Button-RljTGqHl.js} +2 -2
  32. package/dist/{Button-BkjZ7wEu.js.map → Button-RljTGqHl.js.map} +1 -1
  33. package/dist/{Calendar-DsJ6GICt.js → Calendar-CKCikOQL.js} +4 -4
  34. package/dist/{Calendar-DsJ6GICt.js.map → Calendar-CKCikOQL.js.map} +1 -1
  35. package/dist/{Calendar-CGQCditF.cjs → Calendar-DVg1uQuj.cjs} +2 -2
  36. package/dist/{Calendar-CGQCditF.cjs.map → Calendar-DVg1uQuj.cjs.map} +1 -1
  37. package/dist/{Card-CumMi_XB.js → Card-B0bYi4g2.js} +4 -4
  38. package/dist/{Card-CumMi_XB.js.map → Card-B0bYi4g2.js.map} +1 -1
  39. package/dist/{Card-DGTGdaTZ.cjs → Card-BYFuYD-a.cjs} +2 -2
  40. package/dist/{Card-DGTGdaTZ.cjs.map → Card-BYFuYD-a.cjs.map} +1 -1
  41. package/dist/Checkbox-ZYOSBYRt.js +98 -0
  42. package/dist/Checkbox-ZYOSBYRt.js.map +1 -0
  43. package/dist/Checkbox-fzJCwe0j.cjs +2 -0
  44. package/dist/Checkbox-fzJCwe0j.cjs.map +1 -0
  45. package/dist/{Chip-D83svOCW.js → Chip-BiqfnRUi.js} +3 -3
  46. package/dist/{Chip-D83svOCW.js.map → Chip-BiqfnRUi.js.map} +1 -1
  47. package/dist/{Chip-CJuAvgst.cjs → Chip-CdKUtUGE.cjs} +2 -2
  48. package/dist/{Chip-CJuAvgst.cjs.map → Chip-CdKUtUGE.cjs.map} +1 -1
  49. package/dist/{ChoiceCardGroup-CvFzZlgI.js → ChoiceCardGroup-DBohUnRj.js} +3 -3
  50. package/dist/{ChoiceCardGroup-CvFzZlgI.js.map → ChoiceCardGroup-DBohUnRj.js.map} +1 -1
  51. package/dist/{ChoiceCardGroup-6eFM1eL0.cjs → ChoiceCardGroup-d0VVTUi5.cjs} +2 -2
  52. package/dist/{ChoiceCardGroup-6eFM1eL0.cjs.map → ChoiceCardGroup-d0VVTUi5.cjs.map} +1 -1
  53. package/dist/{CodeBlock-BK_KXhos.js → CodeBlock-BX_0tpk3.js} +4 -4
  54. package/dist/{CodeBlock-BK_KXhos.js.map → CodeBlock-BX_0tpk3.js.map} +1 -1
  55. package/dist/{CodeBlock-C_UDrrY6.cjs → CodeBlock-CAAggVXS.cjs} +2 -2
  56. package/dist/{CodeBlock-C_UDrrY6.cjs.map → CodeBlock-CAAggVXS.cjs.map} +1 -1
  57. package/dist/{ColorPicker-BmxZnsNC.cjs → ColorPicker-BCSaT1A-.cjs} +2 -2
  58. package/dist/{ColorPicker-BmxZnsNC.cjs.map → ColorPicker-BCSaT1A-.cjs.map} +1 -1
  59. package/dist/{ColorPicker-DLnB_AvZ.js → ColorPicker-DhSlvwNj.js} +3 -3
  60. package/dist/{ColorPicker-DLnB_AvZ.js.map → ColorPicker-DhSlvwNj.js.map} +1 -1
  61. package/dist/{ColorPickerPanel-CoyKplF5.cjs → ColorPickerPanel-BOGYXXF1.cjs} +2 -2
  62. package/dist/{ColorPickerPanel-CoyKplF5.cjs.map → ColorPickerPanel-BOGYXXF1.cjs.map} +1 -1
  63. package/dist/{ColorPickerPanel-CG9idF4A.js → ColorPickerPanel-D4t3b9bB.js} +3 -3
  64. package/dist/{ColorPickerPanel-CG9idF4A.js.map → ColorPickerPanel-D4t3b9bB.js.map} +1 -1
  65. package/dist/{ConfigProvider-h1WoGC3R.cjs → ConfigProvider-C7DUWHrb.cjs} +2 -2
  66. package/dist/{ConfigProvider-h1WoGC3R.cjs.map → ConfigProvider-C7DUWHrb.cjs.map} +1 -1
  67. package/dist/{ConfigProvider-DDuIJSM7.js → ConfigProvider-DT0yrgmd.js} +2 -2
  68. package/dist/{ConfigProvider-DDuIJSM7.js.map → ConfigProvider-DT0yrgmd.js.map} +1 -1
  69. package/dist/{CopyButton-tRMAy59I.cjs → CopyButton-3585thVM.cjs} +2 -2
  70. package/dist/{CopyButton-tRMAy59I.cjs.map → CopyButton-3585thVM.cjs.map} +1 -1
  71. package/dist/{CopyButton-DdQ-8ExN.js → CopyButton-BEY1gJzK.js} +4 -4
  72. package/dist/{CopyButton-DdQ-8ExN.js.map → CopyButton-BEY1gJzK.js.map} +1 -1
  73. package/dist/{DashedButton-q7AOqKUE.cjs → DashedButton-3C4IZuo4.cjs} +2 -2
  74. package/dist/{DashedButton-q7AOqKUE.cjs.map → DashedButton-3C4IZuo4.cjs.map} +1 -1
  75. package/dist/{DashedButton-DeiALUPA.js → DashedButton-BXZAyMtw.js} +3 -3
  76. package/dist/{DashedButton-DeiALUPA.js.map → DashedButton-BXZAyMtw.js.map} +1 -1
  77. package/dist/{DatePicker-pz634ktl.js → DatePicker-CEFGgXLF.js} +5 -5
  78. package/dist/{DatePicker-pz634ktl.js.map → DatePicker-CEFGgXLF.js.map} +1 -1
  79. package/dist/{DatePicker-eryY6Xmx.cjs → DatePicker-Dyj2halw.cjs} +2 -2
  80. package/dist/{DatePicker-eryY6Xmx.cjs.map → DatePicker-Dyj2halw.cjs.map} +1 -1
  81. package/dist/{DateTimePicker-CmH3ZuzN.cjs → DateTimePicker-CjX4-8PP.cjs} +2 -2
  82. package/dist/{DateTimePicker-CmH3ZuzN.cjs.map → DateTimePicker-CjX4-8PP.cjs.map} +1 -1
  83. package/dist/{DateTimePicker-BJLq9Fud.js → DateTimePicker-hmYBEuUM.js} +8 -8
  84. package/dist/{DateTimePicker-BJLq9Fud.js.map → DateTimePicker-hmYBEuUM.js.map} +1 -1
  85. package/dist/{EmptyState-Cxf4H8Cc.cjs → EmptyState-Bj-vX_UV.cjs} +2 -2
  86. package/dist/{EmptyState-Cxf4H8Cc.cjs.map → EmptyState-Bj-vX_UV.cjs.map} +1 -1
  87. package/dist/{EmptyState-B2QPNhWW.js → EmptyState-DJDNLKT7.js} +4 -4
  88. package/dist/{EmptyState-B2QPNhWW.js.map → EmptyState-DJDNLKT7.js.map} +1 -1
  89. package/dist/{FileCard-Do9D72NA.js → FileCard-C9Ncifnu.js} +5 -5
  90. package/dist/{FileCard-Do9D72NA.js.map → FileCard-C9Ncifnu.js.map} +1 -1
  91. package/dist/{FileCard-D0Sa7WJt.cjs → FileCard-Dr5-z1R3.cjs} +2 -2
  92. package/dist/{FileCard-D0Sa7WJt.cjs.map → FileCard-Dr5-z1R3.cjs.map} +1 -1
  93. package/dist/{FileUploader-B1Arfj1a.cjs → FileUploader-DeyZENqq.cjs} +2 -2
  94. package/dist/{FileUploader-B1Arfj1a.cjs.map → FileUploader-DeyZENqq.cjs.map} +1 -1
  95. package/dist/{FileUploader-4900qKEE.js → FileUploader-XFmBNkA0.js} +6 -6
  96. package/dist/{FileUploader-4900qKEE.js.map → FileUploader-XFmBNkA0.js.map} +1 -1
  97. package/dist/{Flag-DNhhLtCC.js → Flag-Bs0xNP-P.js} +2 -2
  98. package/dist/{Flag-DNhhLtCC.js.map → Flag-Bs0xNP-P.js.map} +1 -1
  99. package/dist/{Flag-D7Vlczlw.cjs → Flag-Bxnx26DM.cjs} +2 -2
  100. package/dist/{Flag-D7Vlczlw.cjs.map → Flag-Bxnx26DM.cjs.map} +1 -1
  101. package/dist/{FullscreenToggle-dU2ai_OZ.cjs → FullscreenToggle-BncatGKj.cjs} +2 -2
  102. package/dist/{FullscreenToggle-dU2ai_OZ.cjs.map → FullscreenToggle-BncatGKj.cjs.map} +1 -1
  103. package/dist/{FullscreenToggle-Bc4fB-Mi.js → FullscreenToggle-DMlp05UN.js} +4 -4
  104. package/dist/{FullscreenToggle-Bc4fB-Mi.js.map → FullscreenToggle-DMlp05UN.js.map} +1 -1
  105. package/dist/Icon-BVULqOJD.cjs +2 -0
  106. package/dist/Icon-BVULqOJD.cjs.map +1 -0
  107. package/dist/{Icon-CophpkHo.js → Icon-DaTvzLBu.js} +2 -1
  108. package/dist/Icon-DaTvzLBu.js.map +1 -0
  109. package/dist/{IconButton-DpTxmj3d.js → IconButton-DXMmtuLA.js} +2 -2
  110. package/dist/{IconButton-DpTxmj3d.js.map → IconButton-DXMmtuLA.js.map} +1 -1
  111. package/dist/{IconButton-DyRC514t.cjs → IconButton-Lv0sDDR9.cjs} +2 -2
  112. package/dist/{IconButton-DyRC514t.cjs.map → IconButton-Lv0sDDR9.cjs.map} +1 -1
  113. package/dist/{ListItem-B4Upc0Hy.js → ListItem-Cn15lJBr.js} +3 -3
  114. package/dist/{ListItem-B4Upc0Hy.js.map → ListItem-Cn15lJBr.js.map} +1 -1
  115. package/dist/{ListItem-DWQorRxG.cjs → ListItem-yXXjtepZ.cjs} +2 -2
  116. package/dist/{ListItem-DWQorRxG.cjs.map → ListItem-yXXjtepZ.cjs.map} +1 -1
  117. package/dist/{Loader-B45H2SMP.cjs → Loader-53HFNMVX.cjs} +2 -2
  118. package/dist/{Loader-B45H2SMP.cjs.map → Loader-53HFNMVX.cjs.map} +1 -1
  119. package/dist/{Loader-B9VXX401.js → Loader-WsjQFl4p.js} +2 -2
  120. package/dist/{Loader-B9VXX401.js.map → Loader-WsjQFl4p.js.map} +1 -1
  121. package/dist/{Modal-Us_E-lb2.js → Modal-DBYcoCbJ.js} +5 -5
  122. package/dist/{Modal-Us_E-lb2.js.map → Modal-DBYcoCbJ.js.map} +1 -1
  123. package/dist/{Modal-DsoSz0Sp.cjs → Modal-V6eyGSzW.cjs} +2 -2
  124. package/dist/{Modal-DsoSz0Sp.cjs.map → Modal-V6eyGSzW.cjs.map} +1 -1
  125. package/dist/{MultiSelect-sKk2KzOd.js → MultiSelect-BsYPr3LD.js} +6 -6
  126. package/dist/{MultiSelect-sKk2KzOd.js.map → MultiSelect-BsYPr3LD.js.map} +1 -1
  127. package/dist/{MultiSelect-CtLpWaBX.cjs → MultiSelect-DS2DRpaP.cjs} +2 -2
  128. package/dist/{MultiSelect-CtLpWaBX.cjs.map → MultiSelect-DS2DRpaP.cjs.map} +1 -1
  129. package/dist/{NumberField-C6qj3nCa.cjs → NumberField-DC3TdGTt.cjs} +2 -2
  130. package/dist/{NumberField-C6qj3nCa.cjs.map → NumberField-DC3TdGTt.cjs.map} +1 -1
  131. package/dist/{NumberField-Cz03nksO.js → NumberField-mFb9pKCx.js} +4 -4
  132. package/dist/{NumberField-Cz03nksO.js.map → NumberField-mFb9pKCx.js.map} +1 -1
  133. package/dist/{OtpField-DLXQYMw1.js → OtpField-1ullIIZQ.js} +2 -2
  134. package/dist/{OtpField-DLXQYMw1.js.map → OtpField-1ullIIZQ.js.map} +1 -1
  135. package/dist/{OtpField-B46P6aMy.cjs → OtpField-BYj9SDHb.cjs} +2 -2
  136. package/dist/{OtpField-B46P6aMy.cjs.map → OtpField-BYj9SDHb.cjs.map} +1 -1
  137. package/dist/{PageLayout-BfeRjBek.cjs → PageLayout-pYL43wI9.cjs} +2 -2
  138. package/dist/{PageLayout-BfeRjBek.cjs.map → PageLayout-pYL43wI9.cjs.map} +1 -1
  139. package/dist/{PageLayout-BWU-p_N9.js → PageLayout-qf0H_EmS.js} +2 -2
  140. package/dist/{PageLayout-BWU-p_N9.js.map → PageLayout-qf0H_EmS.js.map} +1 -1
  141. package/dist/{PageNotFound-nvZm-UCG.cjs → PageNotFound-D1795gJ7.cjs} +2 -2
  142. package/dist/{PageNotFound-nvZm-UCG.cjs.map → PageNotFound-D1795gJ7.cjs.map} +1 -1
  143. package/dist/{PageNotFound-B_nTMrCD.js → PageNotFound-YGVMVvyG.js} +5 -5
  144. package/dist/{PageNotFound-B_nTMrCD.js.map → PageNotFound-YGVMVvyG.js.map} +1 -1
  145. package/dist/{Pagination-BYXUhmSz.js → Pagination-BTvUJiee.js} +3 -3
  146. package/dist/{Pagination-BYXUhmSz.js.map → Pagination-BTvUJiee.js.map} +1 -1
  147. package/dist/{Pagination-CsClNqIu.cjs → Pagination-WJq_7QNi.cjs} +2 -2
  148. package/dist/{Pagination-CsClNqIu.cjs.map → Pagination-WJq_7QNi.cjs.map} +1 -1
  149. package/dist/{RemoveDialog-PHdZi9-d.js → RemoveDialog-BSQ6EMW-.js} +5 -5
  150. package/dist/{RemoveDialog-PHdZi9-d.js.map → RemoveDialog-BSQ6EMW-.js.map} +1 -1
  151. package/dist/{RemoveDialog-D5J9TYap.cjs → RemoveDialog-BhcwsY0q.cjs} +2 -2
  152. package/dist/{RemoveDialog-D5J9TYap.cjs.map → RemoveDialog-BhcwsY0q.cjs.map} +1 -1
  153. package/dist/{RichTextEditor-jWv0t3vJ.cjs → RichTextEditor-Bc1fhvzn.cjs} +2 -2
  154. package/dist/{RichTextEditor-jWv0t3vJ.cjs.map → RichTextEditor-Bc1fhvzn.cjs.map} +1 -1
  155. package/dist/{RichTextEditor-BcmsnYGJ.js → RichTextEditor-CaGPtwXe.js} +9 -9
  156. package/dist/{RichTextEditor-BcmsnYGJ.js.map → RichTextEditor-CaGPtwXe.js.map} +1 -1
  157. package/dist/{RootLayout-q_oWf5et.js → RootLayout-BNwHsuhC.js} +31 -31
  158. package/dist/{RootLayout-q_oWf5et.js.map → RootLayout-BNwHsuhC.js.map} +1 -1
  159. package/dist/{RootLayout-DtZcqk9N.cjs → RootLayout-CB-3FgOp.cjs} +2 -2
  160. package/dist/{RootLayout-DtZcqk9N.cjs.map → RootLayout-CB-3FgOp.cjs.map} +1 -1
  161. package/dist/{Select-CWCeBQ8Q.cjs → Select-Cx1Yl8nq.cjs} +2 -2
  162. package/dist/{Select-CWCeBQ8Q.cjs.map → Select-Cx1Yl8nq.cjs.map} +1 -1
  163. package/dist/{Select-UygxT1Ry.js → Select-vKZzS9K4.js} +6 -6
  164. package/dist/{Select-UygxT1Ry.js.map → Select-vKZzS9K4.js.map} +1 -1
  165. package/dist/{Sidebar-C0OJK29L.js → Sidebar-CJ7DtOqb.js} +5 -5
  166. package/dist/{Sidebar-C0OJK29L.js.map → Sidebar-CJ7DtOqb.js.map} +1 -1
  167. package/dist/{Sidebar-BfBggyuh.cjs → Sidebar-Cv95DJxZ.cjs} +2 -2
  168. package/dist/{Sidebar-BfBggyuh.cjs.map → Sidebar-Cv95DJxZ.cjs.map} +1 -1
  169. package/dist/{SpeedDial-DbvOJ4no.js → SpeedDial-Bb0ioXaO.js} +4 -4
  170. package/dist/{SpeedDial-DbvOJ4no.js.map → SpeedDial-Bb0ioXaO.js.map} +1 -1
  171. package/dist/{SpeedDial-cKvuSMuk.cjs → SpeedDial-D6sO-9ES.cjs} +2 -2
  172. package/dist/{SpeedDial-cKvuSMuk.cjs.map → SpeedDial-D6sO-9ES.cjs.map} +1 -1
  173. package/dist/{Stepper-BxGrP6JZ.js → Stepper-BaEOUnYe.js} +4 -4
  174. package/dist/{Stepper-BxGrP6JZ.js.map → Stepper-BaEOUnYe.js.map} +1 -1
  175. package/dist/{Stepper-Db_ALAc4.cjs → Stepper-CVY8NJEI.cjs} +2 -2
  176. package/dist/{Stepper-Db_ALAc4.cjs.map → Stepper-CVY8NJEI.cjs.map} +1 -1
  177. package/dist/{SwatchPicker-DbAU9-ux.cjs → SwatchPicker-CCJltwHI.cjs} +2 -2
  178. package/dist/{SwatchPicker-DbAU9-ux.cjs.map → SwatchPicker-CCJltwHI.cjs.map} +1 -1
  179. package/dist/{SwatchPicker-D30aSrbY.js → SwatchPicker-CqyWngFJ.js} +2 -2
  180. package/dist/{SwatchPicker-D30aSrbY.js.map → SwatchPicker-CqyWngFJ.js.map} +1 -1
  181. package/dist/{Table--pDmXYad.cjs → Table-AQ7yJhtW.cjs} +2 -2
  182. package/dist/{Table--pDmXYad.cjs.map → Table-AQ7yJhtW.cjs.map} +1 -1
  183. package/dist/{Table-CNjnvZ-k.js → Table-wn-B7iLj.js} +17 -17
  184. package/dist/{Table-CNjnvZ-k.js.map → Table-wn-B7iLj.js.map} +1 -1
  185. package/dist/{Tabs-ozklGWmX.cjs → Tabs-BtcJ2jBl.cjs} +2 -2
  186. package/dist/{Tabs-ozklGWmX.cjs.map → Tabs-BtcJ2jBl.cjs.map} +1 -1
  187. package/dist/{Tabs-B0mWCNaC.js → Tabs-DJMfAUni.js} +4 -4
  188. package/dist/{Tabs-B0mWCNaC.js.map → Tabs-DJMfAUni.js.map} +1 -1
  189. package/dist/{TagsField-BIxwLfSJ.cjs → TagsField-4x3RmGwt.cjs} +2 -2
  190. package/dist/{TagsField-BIxwLfSJ.cjs.map → TagsField-4x3RmGwt.cjs.map} +1 -1
  191. package/dist/{TagsField-CGFm17lP.js → TagsField-Bvh6Fm5Y.js} +5 -5
  192. package/dist/{TagsField-CGFm17lP.js.map → TagsField-Bvh6Fm5Y.js.map} +1 -1
  193. package/dist/{TextField-DvKEj36A.cjs → TextField-DNqnpAWB.cjs} +2 -2
  194. package/dist/{TextField-DvKEj36A.cjs.map → TextField-DNqnpAWB.cjs.map} +1 -1
  195. package/dist/{TextField-CRCYLPpr.js → TextField-DcdwUA9d.js} +4 -4
  196. package/dist/{TextField-CRCYLPpr.js.map → TextField-DcdwUA9d.js.map} +1 -1
  197. package/dist/{ThemeToggle-BwW9L115.js → ThemeToggle-BVQmSMsj.js} +4 -4
  198. package/dist/{ThemeToggle-BwW9L115.js.map → ThemeToggle-BVQmSMsj.js.map} +1 -1
  199. package/dist/{ThemeToggle-DxxLN79b.cjs → ThemeToggle-isboxfZk.cjs} +2 -2
  200. package/dist/{ThemeToggle-DxxLN79b.cjs.map → ThemeToggle-isboxfZk.cjs.map} +1 -1
  201. package/dist/{TimeColumns-D3nqkQbh.js → TimeColumns-CFy_PynH.js} +2 -2
  202. package/dist/{TimeColumns-D3nqkQbh.js.map → TimeColumns-CFy_PynH.js.map} +1 -1
  203. package/dist/{TimeColumns-DB-V4KpQ.cjs → TimeColumns-DxFjjtc7.cjs} +2 -2
  204. package/dist/{TimeColumns-DB-V4KpQ.cjs.map → TimeColumns-DxFjjtc7.cjs.map} +1 -1
  205. package/dist/{TimePicker-D51QkQYy.js → TimePicker-ZO7jOJVa.js} +6 -6
  206. package/dist/{TimePicker-D51QkQYy.js.map → TimePicker-ZO7jOJVa.js.map} +1 -1
  207. package/dist/{TimePicker-D__72q2J.cjs → TimePicker-v1yA7Igl.cjs} +2 -2
  208. package/dist/{TimePicker-D__72q2J.cjs.map → TimePicker-v1yA7Igl.cjs.map} +1 -1
  209. package/dist/{Timeline-WkV4k_we.js → Timeline-D3kzt1dy.js} +3 -3
  210. package/dist/{Timeline-WkV4k_we.js.map → Timeline-D3kzt1dy.js.map} +1 -1
  211. package/dist/{Timeline-CoxW0Ia_.cjs → Timeline-ONU_3gi3.cjs} +2 -2
  212. package/dist/{Timeline-CoxW0Ia_.cjs.map → Timeline-ONU_3gi3.cjs.map} +1 -1
  213. package/dist/{Toaster-BynCHvUr.js → Toaster-C6UK_2TB.js} +2 -2
  214. package/dist/{Toaster-BynCHvUr.js.map → Toaster-C6UK_2TB.js.map} +1 -1
  215. package/dist/{Toaster-tHet1M-T.cjs → Toaster-Qnsq3guQ.cjs} +2 -2
  216. package/dist/{Toaster-tHet1M-T.cjs.map → Toaster-Qnsq3guQ.cjs.map} +1 -1
  217. package/dist/{ToggleButtonGroup-BWd7MOcc.js → ToggleButtonGroup-D9odYMzD.js} +3 -3
  218. package/dist/{ToggleButtonGroup-BWd7MOcc.js.map → ToggleButtonGroup-D9odYMzD.js.map} +1 -1
  219. package/dist/{ToggleButtonGroup-DYRLwKKh.cjs → ToggleButtonGroup-M2oj_3mc.cjs} +2 -2
  220. package/dist/{ToggleButtonGroup-DYRLwKKh.cjs.map → ToggleButtonGroup-M2oj_3mc.cjs.map} +1 -1
  221. package/dist/{TranslatedFields-DHRFcB3n.js → TranslatedFields-Bo5rZ7so.js} +5 -5
  222. package/dist/{TranslatedFields-DHRFcB3n.js.map → TranslatedFields-Bo5rZ7so.js.map} +1 -1
  223. package/dist/{TranslatedFields-B3Gli3TZ.cjs → TranslatedFields-CLMvRpJi.cjs} +2 -2
  224. package/dist/{TranslatedFields-B3Gli3TZ.cjs.map → TranslatedFields-CLMvRpJi.cjs.map} +1 -1
  225. package/dist/UserCard-454Kc7JS.js +74 -0
  226. package/dist/UserCard-454Kc7JS.js.map +1 -0
  227. package/dist/UserCard-CIjZz5xd.cjs +2 -0
  228. package/dist/UserCard-CIjZz5xd.cjs.map +1 -0
  229. package/dist/components/Accordion/index.cjs +1 -1
  230. package/dist/components/Accordion/index.js +1 -1
  231. package/dist/components/Alert/index.cjs +1 -1
  232. package/dist/components/Alert/index.js +1 -1
  233. package/dist/components/AuthLayout/index.cjs +1 -1
  234. package/dist/components/AuthLayout/index.js +1 -1
  235. package/dist/components/Avatar/index.cjs +1 -1
  236. package/dist/components/Avatar/index.js +2 -2
  237. package/dist/components/Breadcrumbs/index.cjs +1 -1
  238. package/dist/components/Breadcrumbs/index.js +1 -1
  239. package/dist/components/Button/index.cjs +1 -1
  240. package/dist/components/Button/index.js +1 -1
  241. package/dist/components/Card/index.cjs +1 -1
  242. package/dist/components/Card/index.js +1 -1
  243. package/dist/components/Checkbox/Checkbox.d.cts +7 -0
  244. package/dist/components/Checkbox/Checkbox.d.ts +7 -0
  245. package/dist/components/Checkbox/index.cjs +1 -1
  246. package/dist/components/Checkbox/index.js +1 -1
  247. package/dist/components/Chip/index.cjs +1 -1
  248. package/dist/components/Chip/index.js +1 -1
  249. package/dist/components/ChoiceCard/index.cjs +1 -1
  250. package/dist/components/ChoiceCard/index.js +1 -1
  251. package/dist/components/CodeBlock/index.cjs +1 -1
  252. package/dist/components/CodeBlock/index.js +1 -1
  253. package/dist/components/ColorPicker/index.cjs +1 -1
  254. package/dist/components/ColorPicker/index.js +1 -1
  255. package/dist/components/CopyButton/index.cjs +1 -1
  256. package/dist/components/CopyButton/index.js +1 -1
  257. package/dist/components/DashedButton/index.cjs +1 -1
  258. package/dist/components/DashedButton/index.js +1 -1
  259. package/dist/components/DatePicker/index.cjs +1 -1
  260. package/dist/components/DatePicker/index.js +1 -1
  261. package/dist/components/DateTimePicker/index.cjs +1 -1
  262. package/dist/components/DateTimePicker/index.js +1 -1
  263. package/dist/components/EmptyState/index.cjs +1 -1
  264. package/dist/components/EmptyState/index.js +1 -1
  265. package/dist/components/FileCard/index.cjs +1 -1
  266. package/dist/components/FileCard/index.js +1 -1
  267. package/dist/components/FileUploader/index.cjs +1 -1
  268. package/dist/components/FileUploader/index.js +1 -1
  269. package/dist/components/Flag/index.cjs +1 -1
  270. package/dist/components/Flag/index.js +1 -1
  271. package/dist/components/FullscreenToggle/index.cjs +1 -1
  272. package/dist/components/FullscreenToggle/index.js +1 -1
  273. package/dist/components/Icon/index.cjs +1 -1
  274. package/dist/components/Icon/index.js +2 -2
  275. package/dist/components/IconButton/index.cjs +1 -1
  276. package/dist/components/IconButton/index.js +1 -1
  277. package/dist/components/List/index.cjs +1 -1
  278. package/dist/components/List/index.js +1 -1
  279. package/dist/components/Loader/index.cjs +1 -1
  280. package/dist/components/Loader/index.js +1 -1
  281. package/dist/components/Modal/index.cjs +1 -1
  282. package/dist/components/Modal/index.js +1 -1
  283. package/dist/components/MultiSelect/index.cjs +1 -1
  284. package/dist/components/MultiSelect/index.js +1 -1
  285. package/dist/components/NumberField/index.cjs +1 -1
  286. package/dist/components/NumberField/index.js +1 -1
  287. package/dist/components/OtpField/index.cjs +1 -1
  288. package/dist/components/OtpField/index.js +1 -1
  289. package/dist/components/PageLayout/index.cjs +1 -1
  290. package/dist/components/PageLayout/index.js +1 -1
  291. package/dist/components/PageNotFound/index.cjs +1 -1
  292. package/dist/components/PageNotFound/index.js +1 -1
  293. package/dist/components/Pagination/index.cjs +1 -1
  294. package/dist/components/Pagination/index.js +1 -1
  295. package/dist/components/RemoveDialog/index.cjs +1 -1
  296. package/dist/components/RemoveDialog/index.js +1 -1
  297. package/dist/components/RichTextEditor/index.cjs +1 -1
  298. package/dist/components/RichTextEditor/index.js +1 -1
  299. package/dist/components/RootLayout/index.cjs +1 -1
  300. package/dist/components/RootLayout/index.js +1 -1
  301. package/dist/components/Select/index.cjs +1 -1
  302. package/dist/components/Select/index.js +1 -1
  303. package/dist/components/Sidebar/index.cjs +1 -1
  304. package/dist/components/Sidebar/index.js +1 -1
  305. package/dist/components/SpeedDial/index.cjs +1 -1
  306. package/dist/components/SpeedDial/index.js +1 -1
  307. package/dist/components/Stepper/index.cjs +1 -1
  308. package/dist/components/Stepper/index.js +1 -1
  309. package/dist/components/SwatchPicker/index.cjs +1 -1
  310. package/dist/components/SwatchPicker/index.js +1 -1
  311. package/dist/components/Table/index.cjs +1 -1
  312. package/dist/components/Table/index.js +1 -1
  313. package/dist/components/Tabs/index.cjs +1 -1
  314. package/dist/components/Tabs/index.js +1 -1
  315. package/dist/components/TagsField/index.cjs +1 -1
  316. package/dist/components/TagsField/index.js +1 -1
  317. package/dist/components/TextField/index.cjs +1 -1
  318. package/dist/components/TextField/index.js +1 -1
  319. package/dist/components/ThemeToggle/index.cjs +1 -1
  320. package/dist/components/ThemeToggle/index.js +1 -1
  321. package/dist/components/TimePicker/index.cjs +1 -1
  322. package/dist/components/TimePicker/index.js +1 -1
  323. package/dist/components/Timeline/index.cjs +1 -1
  324. package/dist/components/Timeline/index.js +1 -1
  325. package/dist/components/Toast/index.cjs +1 -1
  326. package/dist/components/Toast/index.js +1 -1
  327. package/dist/components/ToggleButton/index.cjs +1 -1
  328. package/dist/components/ToggleButton/index.js +1 -1
  329. package/dist/components/TranslatedFields/index.cjs +1 -1
  330. package/dist/components/TranslatedFields/index.js +1 -1
  331. package/dist/components/UserCard/UserCard.d.cts +4 -1
  332. package/dist/components/UserCard/UserCard.d.ts +4 -1
  333. package/dist/components/UserCard/index.cjs +1 -1
  334. package/dist/components/UserCard/index.js +1 -1
  335. package/dist/entries/app.cjs +1 -1
  336. package/dist/entries/app.js +1 -1
  337. package/dist/entries/components.cjs +1 -1
  338. package/dist/entries/components.js +53 -53
  339. package/dist/entries/i18n.cjs +1 -1
  340. package/dist/entries/i18n.js +2 -2
  341. package/dist/entries/icons.cjs +1 -1
  342. package/dist/entries/icons.js +2 -2
  343. package/dist/entries/theme.cjs +1 -1
  344. package/dist/entries/theme.js +1 -1
  345. package/dist/i18n/messages.d.cts +1 -0
  346. package/dist/i18n/messages.d.ts +1 -0
  347. package/dist/icons/names.d.cts +3 -3
  348. package/dist/icons/names.d.ts +3 -3
  349. package/dist/index.cjs +1 -1
  350. package/dist/index.css +1 -1
  351. package/dist/index.js +56 -56
  352. package/dist/{messages-FciBtnCL.js → messages-CGHhwf6F.js} +10 -3
  353. package/dist/messages-CGHhwf6F.js.map +1 -0
  354. package/dist/messages-DZJyiaf9.cjs +36 -0
  355. package/dist/messages-DZJyiaf9.cjs.map +1 -0
  356. package/dist/names-BJnFU_5m.cjs +2 -0
  357. package/dist/names-BJnFU_5m.cjs.map +1 -0
  358. package/dist/{names-D8ABK2Wk.js → names-r21QPjcU.js} +3 -2
  359. package/dist/names-r21QPjcU.js.map +1 -0
  360. package/package.json +1 -1
  361. package/dist/Checkbox-DXOzYIAz.cjs +0 -2
  362. package/dist/Checkbox-DXOzYIAz.cjs.map +0 -1
  363. package/dist/Checkbox-XKL_Q5qj.js +0 -84
  364. package/dist/Checkbox-XKL_Q5qj.js.map +0 -1
  365. package/dist/Icon-CXTl_QAP.cjs +0 -2
  366. package/dist/Icon-CXTl_QAP.cjs.map +0 -1
  367. package/dist/Icon-CophpkHo.js.map +0 -1
  368. package/dist/UserCard-D7U-CLbM.js +0 -74
  369. package/dist/UserCard-D7U-CLbM.js.map +0 -1
  370. package/dist/UserCard-GHw2gTx9.cjs +0 -2
  371. package/dist/UserCard-GHw2gTx9.cjs.map +0 -1
  372. package/dist/messages-C0YutUM1.cjs +0 -36
  373. package/dist/messages-C0YutUM1.cjs.map +0 -1
  374. package/dist/messages-FciBtnCL.js.map +0 -1
  375. package/dist/names-C2Yj1p3u.cjs +0 -2
  376. package/dist/names-C2Yj1p3u.cjs.map +0 -1
  377. package/dist/names-D8ABK2Wk.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SpeedDial-DbvOJ4no.js","sources":["../src/components/SpeedDial/speedDialContext.ts","../src/components/SpeedDial/SpeedDialAction.tsx","../src/components/SpeedDial/SpeedDial.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { TooltipPlacement } from '../Tooltip'\n\n/** Action button size — one step smaller than the dial's FAB. */\nexport type SpeedDialActionSize = 'sm' | 'md' | 'lg'\n\n/** Shared state a `<SpeedDial>` hands down to its `<SpeedDialAction>` children via context. */\nexport interface SpeedDialContextValue {\n /** Size for the action FABs. */\n size: SpeedDialActionSize\n /** Where each action's tooltip label sits (derived from the dial `direction`). */\n placement: TooltipPlacement\n /** Close the dial after an action is clicked. */\n closeOnClick: boolean\n /** Show every action's label persistently (no hover needed) while the dial is open. */\n persistentLabels: boolean\n /** Request the dial to close (called by an action on click). */\n requestClose: () => void\n}\n\nexport const SpeedDialContext = createContext<SpeedDialContextValue | null>(null)\n\n/** Read the surrounding `<SpeedDial>` (or `null` when an action is rendered standalone). */\nexport function useSpeedDial(): SpeedDialContextValue | null {\n return useContext(SpeedDialContext)\n}\n","import { forwardRef, type ButtonHTMLAttributes, type MouseEvent, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Tooltip } from '../Tooltip'\nimport { useSpeedDial } from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface SpeedDialActionProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'color'\n> {\n /** Action icon — a known `IconName` or any node. */\n icon: IconName | ReactNode\n /** Label shown as a tooltip beside the action (also its `aria-label` when a string). */\n label?: ReactNode\n /** Show the label persistently (no hover) while the dial is open — overrides the dial's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Hide the tooltip / persistent label (still used for `aria-label`). */\n hideTooltip?: boolean\n}\n\n/**\n * One action inside a `<SpeedDial>` — a small circular `IconButton` (surface-tinted) with a tooltip\n * `label`. It reads the dial via context for its size, tooltip placement and close-on-click; clicking\n * runs `onClick` then closes the dial. The ref points at the `<button>`.\n */\nexport const SpeedDialAction = forwardRef<HTMLButtonElement, SpeedDialActionProps>(\n function SpeedDialAction(\n { icon, label, tooltipOpen, hideTooltip = false, onClick, disabled, className, ...props },\n ref,\n ) {\n const dial = useSpeedDial()\n const iconNode =\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? <Icon name={icon as IconName} /> : icon\n\n const button = (\n <IconButton\n ref={ref}\n rounded\n variant=\"contained\"\n color=\"surface\"\n size={dial?.size ?? 'sm'}\n disabled={disabled}\n aria-label={typeof label === 'string' ? label : undefined}\n className={clsx(styles.action, className)}\n onClick={(event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (dial?.closeOnClick) dial.requestClose()\n }}\n {...props}\n >\n {iconNode}\n </IconButton>\n )\n\n if (label == null || hideTooltip) return button\n\n const placement = dial?.placement ?? 'left'\n // persistent label: render a static label beside the button (no hover) — like MUI's tooltipOpen\n const persistent = tooltipOpen ?? dial?.persistentLabels ?? false\n if (persistent) {\n return (\n <span\n className={clsx(\n styles.actionWrap,\n placement === 'top' ? styles.labelTop : styles.labelLeft,\n )}\n >\n {button}\n <span className={styles.actionLabel}>{label}</span>\n </span>\n )\n }\n\n return (\n <Tooltip content={label} placement={placement}>\n {button}\n </Tooltip>\n )\n },\n)\n","import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport type { ThemeColor } from '../../theme'\nimport type { TooltipPlacement } from '../Tooltip'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { SpeedDialAction } from './SpeedDialAction'\nimport {\n SpeedDialContext,\n type SpeedDialActionSize,\n type SpeedDialContextValue,\n} from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type SpeedDialSize = 'sm' | 'md' | 'lg'\nexport type SpeedDialDirection = 'up' | 'down' | 'left' | 'right'\n\n/** The FAB size → the (smaller) action-button size. */\nconst ACTION_SIZE: Record<SpeedDialSize, SpeedDialActionSize> = { sm: 'sm', md: 'sm', lg: 'md' }\n/** Tooltip side per direction — labels sit left of a vertical dial, above a horizontal one. */\nconst TOOLTIP_PLACEMENT: Record<SpeedDialDirection, TooltipPlacement> = {\n up: 'left',\n down: 'left',\n left: 'top',\n right: 'top',\n}\n\n/** A data-driven action for the `actions` prop. */\nexport interface SpeedDialActionItem {\n /** Stable key (falls back to the index). */\n key?: string\n icon: IconName | ReactNode\n label?: ReactNode\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void\n disabled?: boolean\n}\n\nexport interface SpeedDialProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color' | 'onChange'> {\n /** Accessible label for the FAB (required — it's icon-only). */\n ariaLabel: string\n /** FAB icon. Defaults to `Add` (a `+`). */\n icon?: IconName | ReactNode\n /** Icon shown while open. Omit to rotate the `icon` 45° instead (a `+` becomes a `×`). */\n openIcon?: IconName | ReactNode\n /** Which way the actions fan out. Defaults to `up`. */\n direction?: SpeedDialDirection\n /** Theme palette token tinting the FAB. Defaults to `primary`. */\n color?: ThemeColor\n /** FAB size (actions render one step smaller). Defaults to `md`. */\n size?: SpeedDialSize\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Open on hover (also opens on click). Defaults to `true`. */\n openOnHover?: boolean\n /** Close the dial after an action is clicked. Defaults to `true`. */\n closeOnActionClick?: boolean\n /** Show every action's label persistently while open (no hover needed) — like MUI's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Data-driven actions — an alternative to `<SpeedDialAction>` children. */\n actions?: SpeedDialActionItem[]\n /** Disables the FAB (and hover-opening). */\n disabled?: boolean\n /** `<SpeedDialAction>` children (used when `actions` is not given). */\n children?: ReactNode\n}\n\n/**\n * A floating action button that reveals a set of related actions on hover / click — fanning out in\n * `direction` (`up` default). The FAB icon rotates 45° when open (a `+` → `×`) unless an `openIcon` is\n * given. Each `<SpeedDialAction>` is a small circular button with a tooltip label; supply them via the\n * data-driven `actions` prop or as children. Opens on hover (`openOnHover`) and click; closes on\n * outside-pointerdown, Escape (refocusing the FAB), or selecting an action. Controlled (`open` +\n * `onOpenChange`) or uncontrolled (`defaultOpen`). The ref points at the root; position it (e.g.\n * `fixed` bottom-right) via `style`/`className`. The FAB carries `aria-expanded`/`aria-controls`.\n */\nexport const SpeedDial = forwardRef<HTMLDivElement, SpeedDialProps>(function SpeedDial(\n {\n ariaLabel,\n icon = 'Add',\n openIcon,\n direction = 'up',\n color = 'primary',\n size = 'md',\n open,\n defaultOpen = false,\n onOpenChange,\n openOnHover = true,\n closeOnActionClick = true,\n tooltipOpen = false,\n actions,\n disabled = false,\n children,\n className,\n style,\n ...props\n },\n forwardedRef,\n) {\n const rootRef = useRef<HTMLDivElement | null>(null)\n const fabRef = useRef<HTMLButtonElement | null>(null)\n const actionsId = useId()\n\n const isControlled = open !== undefined\n const [internal, setInternal] = useState(defaultOpen)\n const isOpen = isControlled ? open : internal\n\n const setOpen = (next: boolean) => {\n if (!isControlled) setInternal(next)\n onOpenChange?.(next)\n }\n // keep a stable reference for the document listeners below\n const setOpenRef = useRef(setOpen)\n setOpenRef.current = setOpen\n\n // while open: close on outside pointerdown / Escape (Escape refocuses the FAB)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n if (rootRef.current && !rootRef.current.contains(event.target as Node)) {\n setOpenRef.current(false)\n }\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setOpenRef.current(false)\n fabRef.current?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen])\n\n const setRootRef = (node: HTMLDivElement | null) => {\n rootRef.current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n }\n\n const renderIcon = (value: IconName | ReactNode) =>\n typeof value === 'string' && ICON_NAME_SET.has(value) ? (\n <Icon name={value as IconName} />\n ) : (\n value\n )\n\n const ctx: SpeedDialContextValue = {\n size: ACTION_SIZE[size],\n placement: TOOLTIP_PLACEMENT[direction],\n closeOnClick: closeOnActionClick,\n persistentLabels: tooltipOpen,\n requestClose: () => setOpen(false),\n }\n\n const hoverProps =\n openOnHover && !disabled\n ? { onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false) }\n : {}\n\n return (\n <div\n ref={setRootRef}\n className={clsx(styles.speedDial, className)}\n style={style as CSSProperties}\n {...hoverProps}\n {...props}\n >\n <div\n id={actionsId}\n className={clsx(styles.actions, styles[direction])}\n data-open={isOpen ? 'true' : 'false'}\n >\n <SpeedDialContext.Provider value={ctx}>\n {actions\n ? actions.map((action, index) => (\n <SpeedDialAction\n key={action.key ?? index}\n icon={action.icon}\n label={action.label}\n onClick={action.onClick}\n disabled={action.disabled}\n />\n ))\n : children}\n </SpeedDialContext.Provider>\n </div>\n\n <IconButton\n ref={fabRef}\n rounded\n variant=\"contained\"\n color={color}\n size={size}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n aria-controls={actionsId}\n className={styles.fab}\n onClick={() => setOpen(!isOpen)}\n >\n <span className={clsx(styles.fabIcon, !openIcon && isOpen && styles.fabIconOpen)}>\n {isOpen && openIcon != null ? renderIcon(openIcon) : renderIcon(icon)}\n </span>\n </IconButton>\n </div>\n )\n})\n"],"names":["SpeedDialContext","createContext","useSpeedDial","useContext","ICON_NAME_SET","ICON_NAMES","SpeedDialAction","forwardRef","icon","label","tooltipOpen","hideTooltip","onClick","disabled","className","props","ref","dial","iconNode","jsx","Icon","button","IconButton","clsx","styles","event","placement","jsxs","Tooltip","ACTION_SIZE","TOOLTIP_PLACEMENT","SpeedDial","ariaLabel","openIcon","direction","color","size","open","defaultOpen","onOpenChange","openOnHover","closeOnActionClick","actions","children","style","forwardedRef","rootRef","useRef","fabRef","actionsId","useId","isControlled","internal","setInternal","useState","isOpen","setOpen","next","setOpenRef","useEffect","onPointerDown","onKeyDown","_a","setRootRef","node","renderIcon","value","ctx","hoverProps","action","index"],"mappings":";;;;;;;AAoBO,MAAMA,IAAmBC,EAA4C,IAAI;AAGzE,SAASC,IAA6C;AAC3D,SAAOC,EAAWH,CAAgB;AACpC;;;;;;;;;;;;;;;;GChBMI,KAAgB,IAAI,IAAYC,CAAU,GAqBnCC,KAAkBC;AAAA,EAC7B,SACE,EAAE,MAAAC,GAAM,OAAAC,GAAO,aAAAC,GAAa,aAAAC,IAAc,IAAO,S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ACb;AAAA,cAAA;AAAA,gBAEC,MAAM+D,EAAO;AAAA,gBACb,OAAOA,EAAO;AAAA,gBACd,SAASA,EAAO;AAAA,gBAChB,UAAUA,EAAO;AAAA,cAAA;AAAA,cAJZA,EAAO,OAAOC;AAAA,YAAA,CAMtB,IACD3B,EAAA,CACN;AAAA,UAAA;AAAA,QAAA;AAAA,QAGF,gBAAAxB;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,KAAK0B;AAAA,YACL,SAAO;AAAA,YACP,SAAQ;AAAA,YACR,OAAAb;AAAA,YACA,MAAAC;AAAA,YACA,UAAAvB;AAAA,YACA,cAAYmB;AAAA,YACZ,iBAAc;AAAA,YACd,iBAAeuB;AAAA,YACf,iBAAeN;AAAA,YACf,WAAWzB,EAAO;AAAA,YAClB,SAAS,MAAMgC,EAAQ,CAACD,CAAM;AAAA,YAE9B,UAAA,gBAAApC,EAAC,UAAK,WAAWI,EAAKC,EAAO,SAAS,CAACS,KAAYsB,KAAU/B,EAAO,WAAW,GAC5E,UAAA+B,KAAUtB,KAAY,OAAOgC,EAAWhC,CAAQ,IAAIgC,EAAWzD,CAAI,EAAA,CACtE;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
1
+ {"version":3,"file":"SpeedDial-Bb0ioXaO.js","sources":["../src/components/SpeedDial/speedDialContext.ts","../src/components/SpeedDial/SpeedDialAction.tsx","../src/components/SpeedDial/SpeedDial.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { TooltipPlacement } from '../Tooltip'\n\n/** Action button size — one step smaller than the dial's FAB. */\nexport type SpeedDialActionSize = 'sm' | 'md' | 'lg'\n\n/** Shared state a `<SpeedDial>` hands down to its `<SpeedDialAction>` children via context. */\nexport interface SpeedDialContextValue {\n /** Size for the action FABs. */\n size: SpeedDialActionSize\n /** Where each action's tooltip label sits (derived from the dial `direction`). */\n placement: TooltipPlacement\n /** Close the dial after an action is clicked. */\n closeOnClick: boolean\n /** Show every action's label persistently (no hover needed) while the dial is open. */\n persistentLabels: boolean\n /** Request the dial to close (called by an action on click). */\n requestClose: () => void\n}\n\nexport const SpeedDialContext = createContext<SpeedDialContextValue | null>(null)\n\n/** Read the surrounding `<SpeedDial>` (or `null` when an action is rendered standalone). */\nexport function useSpeedDial(): SpeedDialContextValue | null {\n return useContext(SpeedDialContext)\n}\n","import { forwardRef, type ButtonHTMLAttributes, type MouseEvent, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Tooltip } from '../Tooltip'\nimport { useSpeedDial } from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface SpeedDialActionProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'color'\n> {\n /** Action icon — a known `IconName` or any node. */\n icon: IconName | ReactNode\n /** Label shown as a tooltip beside the action (also its `aria-label` when a string). */\n label?: ReactNode\n /** Show the label persistently (no hover) while the dial is open — overrides the dial's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Hide the tooltip / persistent label (still used for `aria-label`). */\n hideTooltip?: boolean\n}\n\n/**\n * One action inside a `<SpeedDial>` — a small circular `IconButton` (surface-tinted) with a tooltip\n * `label`. It reads the dial via context for its size, tooltip placement and close-on-click; clicking\n * runs `onClick` then closes the dial. The ref points at the `<button>`.\n */\nexport const SpeedDialAction = forwardRef<HTMLButtonElement, SpeedDialActionProps>(\n function SpeedDialAction(\n { icon, label, tooltipOpen, hideTooltip = false, onClick, disabled, className, ...props },\n ref,\n ) {\n const dial = useSpeedDial()\n const iconNode =\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? <Icon name={icon as IconName} /> : icon\n\n const button = (\n <IconButton\n ref={ref}\n rounded\n variant=\"contained\"\n color=\"surface\"\n size={dial?.size ?? 'sm'}\n disabled={disabled}\n aria-label={typeof label === 'string' ? label : undefined}\n className={clsx(styles.action, className)}\n onClick={(event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (dial?.closeOnClick) dial.requestClose()\n }}\n {...props}\n >\n {iconNode}\n </IconButton>\n )\n\n if (label == null || hideTooltip) return button\n\n const placement = dial?.placement ?? 'left'\n // persistent label: render a static label beside the button (no hover) — like MUI's tooltipOpen\n const persistent = tooltipOpen ?? dial?.persistentLabels ?? false\n if (persistent) {\n return (\n <span\n className={clsx(\n styles.actionWrap,\n placement === 'top' ? styles.labelTop : styles.labelLeft,\n )}\n >\n {button}\n <span className={styles.actionLabel}>{label}</span>\n </span>\n )\n }\n\n return (\n <Tooltip content={label} placement={placement}>\n {button}\n </Tooltip>\n )\n },\n)\n","import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport type { ThemeColor } from '../../theme'\nimport type { TooltipPlacement } from '../Tooltip'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { SpeedDialAction } from './SpeedDialAction'\nimport {\n SpeedDialContext,\n type SpeedDialActionSize,\n type SpeedDialContextValue,\n} from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type SpeedDialSize = 'sm' | 'md' | 'lg'\nexport type SpeedDialDirection = 'up' | 'down' | 'left' | 'right'\n\n/** The FAB size → the (smaller) action-button size. */\nconst ACTION_SIZE: Record<SpeedDialSize, SpeedDialActionSize> = { sm: 'sm', md: 'sm', lg: 'md' }\n/** Tooltip side per direction — labels sit left of a vertical dial, above a horizontal one. */\nconst TOOLTIP_PLACEMENT: Record<SpeedDialDirection, TooltipPlacement> = {\n up: 'left',\n down: 'left',\n left: 'top',\n right: 'top',\n}\n\n/** A data-driven action for the `actions` prop. */\nexport interface SpeedDialActionItem {\n /** Stable key (falls back to the index). */\n key?: string\n icon: IconName | ReactNode\n label?: ReactNode\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void\n disabled?: boolean\n}\n\nexport interface SpeedDialProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color' | 'onChange'> {\n /** Accessible label for the FAB (required — it's icon-only). */\n ariaLabel: string\n /** FAB icon. Defaults to `Add` (a `+`). */\n icon?: IconName | ReactNode\n /** Icon shown while open. Omit to rotate the `icon` 45° instead (a `+` becomes a `×`). */\n openIcon?: IconName | ReactNode\n /** Which way the actions fan out. Defaults to `up`. */\n direction?: SpeedDialDirection\n /** Theme palette token tinting the FAB. Defaults to `primary`. */\n color?: ThemeColor\n /** FAB size (actions render one step smaller). Defaults to `md`. */\n size?: SpeedDialSize\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Open on hover (also opens on click). Defaults to `true`. */\n openOnHover?: boolean\n /** Close the dial after an action is clicked. Defaults to `true`. */\n closeOnActionClick?: boolean\n /** Show every action's label persistently while open (no hover needed) — like MUI's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Data-driven actions — an alternative to `<SpeedDialAction>` children. */\n actions?: SpeedDialActionItem[]\n /** Disables the FAB (and hover-opening). */\n disabled?: boolean\n /** `<SpeedDialAction>` children (used when `actions` is not given). */\n children?: ReactNode\n}\n\n/**\n * A floating action button that reveals a set of related actions on hover / click — fanning out in\n * `direction` (`up` default). The FAB icon rotates 45° when open (a `+` → `×`) unless an `openIcon` is\n * given. Each `<SpeedDialAction>` is a small circular button with a tooltip label; supply them via the\n * data-driven `actions` prop or as children. Opens on hover (`openOnHover`) and click; closes on\n * outside-pointerdown, Escape (refocusing the FAB), or selecting an action. Controlled (`open` +\n * `onOpenChange`) or uncontrolled (`defaultOpen`). The ref points at the root; position it (e.g.\n * `fixed` bottom-right) via `style`/`className`. The FAB carries `aria-expanded`/`aria-controls`.\n */\nexport const SpeedDial = forwardRef<HTMLDivElement, SpeedDialProps>(function SpeedDial(\n {\n ariaLabel,\n icon = 'Add',\n openIcon,\n direction = 'up',\n color = 'primary',\n size = 'md',\n open,\n defaultOpen = false,\n onOpenChange,\n openOnHover = true,\n closeOnActionClick = true,\n tooltipOpen = false,\n actions,\n disabled = false,\n children,\n className,\n style,\n ...props\n },\n forwardedRef,\n) {\n const rootRef = useRef<HTMLDivElement | null>(null)\n const fabRef = useRef<HTMLButtonElement | null>(null)\n const actionsId = useId()\n\n const isControlled = open !== undefined\n const [internal, setInternal] = useState(defaultOpen)\n const isOpen = isControlled ? open : internal\n\n const setOpen = (next: boolean) => {\n if (!isControlled) setInternal(next)\n onOpenChange?.(next)\n }\n // keep a stable reference for the document listeners below\n const setOpenRef = useRef(setOpen)\n setOpenRef.current = setOpen\n\n // while open: close on outside pointerdown / Escape (Escape refocuses the FAB)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n if (rootRef.current && !rootRef.current.contains(event.target as Node)) {\n setOpenRef.current(false)\n }\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setOpenRef.current(false)\n fabRef.current?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen])\n\n const setRootRef = (node: HTMLDivElement | null) => {\n rootRef.current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n }\n\n const renderIcon = (value: IconName | ReactNode) =>\n typeof value === 'string' && ICON_NAME_SET.has(value) ? (\n <Icon name={value as IconName} />\n ) : (\n value\n )\n\n const ctx: SpeedDialContextValue = {\n size: ACTION_SIZE[size],\n placement: TOOLTIP_PLACEMENT[direction],\n closeOnClick: closeOnActionClick,\n persistentLabels: tooltipOpen,\n requestClose: () => setOpen(false),\n }\n\n const hoverProps =\n openOnHover && !disabled\n ? { onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false) }\n : {}\n\n return (\n <div\n ref={setRootRef}\n className={clsx(styles.speedDial, className)}\n style={style as CSSProperties}\n {...hoverProps}\n {...props}\n >\n <div\n id={actionsId}\n className={clsx(styles.actions, styles[direction])}\n data-open={isOpen ? 'true' : 'false'}\n >\n <SpeedDialContext.Provider value={ctx}>\n {actions\n ? actions.map((action, index) => (\n <SpeedDialAction\n key={action.key ?? index}\n icon={action.icon}\n label={action.label}\n onClick={action.onClick}\n disabled={action.disabled}\n />\n ))\n : children}\n </SpeedDialContext.Provider>\n </div>\n\n <IconButton\n ref={fabRef}\n rounded\n variant=\"contained\"\n color={color}\n size={size}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n aria-controls={actionsId}\n className={styles.fab}\n onClick={() => setOpen(!isOpen)}\n >\n <span className={clsx(styles.fabIcon, !openIcon && isOpen && styles.fabIconOpen)}>\n {isOpen && openIcon != null ? renderIcon(openIcon) : renderIcon(icon)}\n </span>\n </IconButton>\n </div>\n )\n})\n"],"names":["SpeedDialContext","createContext","useSpeedDial","useContext","ICON_NAME_SET","ICON_NAMES","SpeedDialAction","forwardRef","icon","label","tooltipOpen","hideTooltip","onClick","disabled","className","props","ref","dial","iconNode","jsx","Icon","button","IconButton","clsx","styles","event","placement","jsxs","Tooltip","ACTION_SIZE","TOOLTIP_PLACEMENT","SpeedDial","ariaLabel","openIcon","direction","color","size","open","defaultOpen","onOpenChange","openOnHover","closeOnActionClick","actions","children","style","forwardedRef","rootRef","useRef","fabRef","actionsId","useId","isControlled","internal","setInternal","useState","isOpen","setOpen","next","setOpenRef","useEffect","onPointerDown","onKeyDown","_a","setRootRef","node","renderIcon","value","ctx","hoverProps","action","index"],"mappings":";;;;;;;AAoBO,MAAMA,IAAmBC,EAA4C,IAAI;AAGzE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EAAO,SAASA,EAAOU,CAAS,CAAC;AAAA,YACjD,aAAWqB,IAAS,SAAS;AAAA,YAE7B,UAAA,gBAAApC,EAACnB,EAAiB,UAAjB,EAA0B,OAAOmE,GAC/B,UAAAzB,IACGA,EAAQ,IAAI,CAAC2B,GAAQC,MACnB,gBAAAnD;AAAA,cAACb;AAAA,cAAA;AAAA,gBAEC,MAAM+D,EAAO;AAAA,gBACb,OAAOA,EAAO;AAAA,gBACd,SAASA,EAAO;AAAA,gBAChB,UAAUA,EAAO;AAAA,cAAA;AAAA,cAJZA,EAAO,OAAOC;AAAA,YAAA,CAMtB,IACD3B,EAAA,CACN;AAAA,UAAA;AAAA,QAAA;AAAA,QAGF,gBAAAxB;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,KAAK0B;AAAA,YACL,SAAO;AAAA,YACP,SAAQ;AAAA,YACR,OAAAb;AAAA,YACA,MAAAC;AAAA,YACA,UAAAvB;AAAA,YACA,cAAYmB;AAAA,YACZ,iBAAc;AAAA,YACd,iBAAeuB;AAAA,YACf,iBAAeN;AAAA,YACf,WAAWzB,EAAO;AAAA,YAClB,SAAS,MAAMgC,EAAQ,CAACD,CAAM;AAAA,YAE9B,UAAA,gBAAApC,EAAC,UAAK,WAAWI,EAAKC,EAAO,SAAS,CAACS,KAAYsB,KAAU/B,EAAO,WAAW,GAC5E,UAAA+B,KAAUtB,KAAY,OAAOgC,EAAWhC,CAAQ,IAAIgC,EAAWzD,CAAI,EAAA,CACtE;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
@@ -1,2 +1,2 @@
1
- "use strict";const n=require("react/jsx-runtime"),o=require("react"),_=require("clsx"),A=require("./names-C2Yj1p3u.cjs"),C=require("./Icon-CXTl_QAP.cjs"),R=require("./IconButton-DyRC514t.cjs"),G=require("./Tooltip-Ao7az09p.cjs"),M=o.createContext(null);function H(){return o.useContext(M)}const J="_speedDial_1qwl9_4",Q="_fab_1qwl9_9",U="_fabIcon_1qwl9_17",V="_fabIconOpen_1qwl9_21",X="_actions_1qwl9_26",Y="_up_1qwl9_47",ee="_down_1qwl9_53",te="_left_1qwl9_59",ne="_right_1qwl9_65",se="_action_1qwl9_26",oe="_actionWrap_1qwl9_91",ce="_actionLabel_1qwl9_95",re="_labelLeft_1qwl9_110",ae="_labelTop_1qwl9_117",s={speedDial:J,fab:Q,fabIcon:U,fabIconOpen:V,actions:X,up:Y,down:ee,left:te,right:ne,action:se,actionWrap:oe,actionLabel:ce,labelLeft:re,labelTop:ae},le=new Set(A.ICON_NAMES),k=o.forwardRef(function({icon:a,label:c,tooltipOpen:i,hideTooltip:b=!1,onClick:u,disabled:m,className:w,...I},f){const t=H(),N=typeof a=="string"&&le.has(a)?n.jsx(C.Icon,{name:a}):a,p=n.jsx(R.IconButton,{ref:f,rounded:!0,variant:"contained",color:"surface",size:(t==null?void 0:t.size)??"sm",disabled:m,"aria-label":typeof c=="string"?c:void 0,className:_.clsx(s.action,w),onClick:E=>{u==null||u(E),t!=null&&t.closeOnClick&&t.requestClose()},...I,children:N});if(c==null||b)return p;const d=(t==null?void 0:t.placement)??"left";return i??(t==null?void 0:t.persistentLabels)??!1?n.jsxs("span",{className:_.clsx(s.actionWrap,d==="top"?s.labelTop:s.labelLeft),children:[p,n.jsx("span",{className:s.actionLabel,children:c})]}):n.jsx(G.Tooltip,{content:c,placement:d,children:p})}),ie=new Set(A.ICON_NAMES),ue={sm:"sm",md:"sm",lg:"md"},fe={up:"left",down:"left",left:"top",right:"top"},pe=o.forwardRef(function({ariaLabel:a,icon:c="Add",openIcon:i,direction:b="up",color:u="primary",size:m="md",open:w,defaultOpen:I=!1,onOpenChange:f,openOnHover:t=!0,closeOnActionClick:N=!0,tooltipOpen:p=!1,actions:d,disabled:L=!1,children:E,className:P,style:W,...B},q){const S=o.useRef(null),j=o.useRef(null),v=o.useId(),O=w!==void 0,[z,K]=o.useState(I),r=O?w:z,l=e=>{O||K(e),f==null||f(e)},D=o.useRef(l);D.current=l,o.useEffect(()=>{if(!r)return;const e=h=>{S.current&&!S.current.contains(h.target)&&D.current(!1)},x=h=>{var y;h.key==="Escape"&&(D.current(!1),(y=j.current)==null||y.focus())};return document.addEventListener("pointerdown",e),document.addEventListener("keydown",x),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",x)}},[r]);const Z=e=>{S.current=e,typeof q=="function"?q(e):q&&(q.current=e)},T=e=>typeof e=="string"&&ie.has(e)?n.jsx(C.Icon,{name:e}):e,$={size:ue[m],placement:fe[b],closeOnClick:N,persistentLabels:p,requestClose:()=>l(!1)},F=t&&!L?{onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1)}:{};return n.jsxs("div",{ref:Z,className:_.clsx(s.speedDial,P),style:W,...F,...B,children:[n.jsx("div",{id:v,className:_.clsx(s.actions,s[b]),"data-open":r?"true":"false",children:n.jsx(M.Provider,{value:$,children:d?d.map((e,x)=>n.jsx(k,{icon:e.icon,label:e.label,onClick:e.onClick,disabled:e.disabled},e.key??x)):E})}),n.jsx(R.IconButton,{ref:j,rounded:!0,variant:"contained",color:u,size:m,disabled:L,"aria-label":a,"aria-haspopup":"true","aria-expanded":r,"aria-controls":v,className:s.fab,onClick:()=>l(!r),children:n.jsx("span",{className:_.clsx(s.fabIcon,!i&&r&&s.fabIconOpen),children:r&&i!=null?T(i):T(c)})})]})});exports.SpeedDial=pe;exports.SpeedDialAction=k;
2
- //# sourceMappingURL=SpeedDial-cKvuSMuk.cjs.map
1
+ "use strict";const n=require("react/jsx-runtime"),o=require("react"),_=require("clsx"),A=require("./names-BJnFU_5m.cjs"),C=require("./Icon-BVULqOJD.cjs"),R=require("./IconButton-Lv0sDDR9.cjs"),G=require("./Tooltip-Ao7az09p.cjs"),M=o.createContext(null);function H(){return o.useContext(M)}const J="_speedDial_1qwl9_4",Q="_fab_1qwl9_9",U="_fabIcon_1qwl9_17",V="_fabIconOpen_1qwl9_21",X="_actions_1qwl9_26",Y="_up_1qwl9_47",ee="_down_1qwl9_53",te="_left_1qwl9_59",ne="_right_1qwl9_65",se="_action_1qwl9_26",oe="_actionWrap_1qwl9_91",ce="_actionLabel_1qwl9_95",re="_labelLeft_1qwl9_110",ae="_labelTop_1qwl9_117",s={speedDial:J,fab:Q,fabIcon:U,fabIconOpen:V,actions:X,up:Y,down:ee,left:te,right:ne,action:se,actionWrap:oe,actionLabel:ce,labelLeft:re,labelTop:ae},le=new Set(A.ICON_NAMES),k=o.forwardRef(function({icon:a,label:c,tooltipOpen:i,hideTooltip:b=!1,onClick:u,disabled:m,className:w,...I},f){const t=H(),N=typeof a=="string"&&le.has(a)?n.jsx(C.Icon,{name:a}):a,p=n.jsx(R.IconButton,{ref:f,rounded:!0,variant:"contained",color:"surface",size:(t==null?void 0:t.size)??"sm",disabled:m,"aria-label":typeof c=="string"?c:void 0,className:_.clsx(s.action,w),onClick:E=>{u==null||u(E),t!=null&&t.closeOnClick&&t.requestClose()},...I,children:N});if(c==null||b)return p;const d=(t==null?void 0:t.placement)??"left";return i??(t==null?void 0:t.persistentLabels)??!1?n.jsxs("span",{className:_.clsx(s.actionWrap,d==="top"?s.labelTop:s.labelLeft),children:[p,n.jsx("span",{className:s.actionLabel,children:c})]}):n.jsx(G.Tooltip,{content:c,placement:d,children:p})}),ie=new Set(A.ICON_NAMES),ue={sm:"sm",md:"sm",lg:"md"},fe={up:"left",down:"left",left:"top",right:"top"},pe=o.forwardRef(function({ariaLabel:a,icon:c="Add",openIcon:i,direction:b="up",color:u="primary",size:m="md",open:w,defaultOpen:I=!1,onOpenChange:f,openOnHover:t=!0,closeOnActionClick:N=!0,tooltipOpen:p=!1,actions:d,disabled:L=!1,children:E,className:P,style:W,...B},q){const S=o.useRef(null),j=o.useRef(null),v=o.useId(),O=w!==void 0,[z,K]=o.useState(I),r=O?w:z,l=e=>{O||K(e),f==null||f(e)},D=o.useRef(l);D.current=l,o.useEffect(()=>{if(!r)return;const e=h=>{S.current&&!S.current.contains(h.target)&&D.current(!1)},x=h=>{var y;h.key==="Escape"&&(D.current(!1),(y=j.current)==null||y.focus())};return document.addEventListener("pointerdown",e),document.addEventListener("keydown",x),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",x)}},[r]);const Z=e=>{S.current=e,typeof q=="function"?q(e):q&&(q.current=e)},T=e=>typeof e=="string"&&ie.has(e)?n.jsx(C.Icon,{name:e}):e,$={size:ue[m],placement:fe[b],closeOnClick:N,persistentLabels:p,requestClose:()=>l(!1)},F=t&&!L?{onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1)}:{};return n.jsxs("div",{ref:Z,className:_.clsx(s.speedDial,P),style:W,...F,...B,children:[n.jsx("div",{id:v,className:_.clsx(s.actions,s[b]),"data-open":r?"true":"false",children:n.jsx(M.Provider,{value:$,children:d?d.map((e,x)=>n.jsx(k,{icon:e.icon,label:e.label,onClick:e.onClick,disabled:e.disabled},e.key??x)):E})}),n.jsx(R.IconButton,{ref:j,rounded:!0,variant:"contained",color:u,size:m,disabled:L,"aria-label":a,"aria-haspopup":"true","aria-expanded":r,"aria-controls":v,className:s.fab,onClick:()=>l(!r),children:n.jsx("span",{className:_.clsx(s.fabIcon,!i&&r&&s.fabIconOpen),children:r&&i!=null?T(i):T(c)})})]})});exports.SpeedDial=pe;exports.SpeedDialAction=k;
2
+ //# sourceMappingURL=SpeedDial-D6sO-9ES.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpeedDial-cKvuSMuk.cjs","sources":["../src/components/SpeedDial/speedDialContext.ts","../src/components/SpeedDial/SpeedDialAction.tsx","../src/components/SpeedDial/SpeedDial.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { TooltipPlacement } from '../Tooltip'\n\n/** Action button size — one step smaller than the dial's FAB. */\nexport type SpeedDialActionSize = 'sm' | 'md' | 'lg'\n\n/** Shared state a `<SpeedDial>` hands down to its `<SpeedDialAction>` children via context. */\nexport interface SpeedDialContextValue {\n /** Size for the action FABs. */\n size: SpeedDialActionSize\n /** Where each action's tooltip label sits (derived from the dial `direction`). */\n placement: TooltipPlacement\n /** Close the dial after an action is clicked. */\n closeOnClick: boolean\n /** Show every action's label persistently (no hover needed) while the dial is open. */\n persistentLabels: boolean\n /** Request the dial to close (called by an action on click). */\n requestClose: () => void\n}\n\nexport const SpeedDialContext = createContext<SpeedDialContextValue | null>(null)\n\n/** Read the surrounding `<SpeedDial>` (or `null` when an action is rendered standalone). */\nexport function useSpeedDial(): SpeedDialContextValue | null {\n return useContext(SpeedDialContext)\n}\n","import { forwardRef, type ButtonHTMLAttributes, type MouseEvent, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Tooltip } from '../Tooltip'\nimport { useSpeedDial } from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface SpeedDialActionProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'color'\n> {\n /** Action icon — a known `IconName` or any node. */\n icon: IconName | ReactNode\n /** Label shown as a tooltip beside the action (also its `aria-label` when a string). */\n label?: ReactNode\n /** Show the label persistently (no hover) while the dial is open — overrides the dial's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Hide the tooltip / persistent label (still used for `aria-label`). */\n hideTooltip?: boolean\n}\n\n/**\n * One action inside a `<SpeedDial>` — a small circular `IconButton` (surface-tinted) with a tooltip\n * `label`. It reads the dial via context for its size, tooltip placement and close-on-click; clicking\n * runs `onClick` then closes the dial. The ref points at the `<button>`.\n */\nexport const SpeedDialAction = forwardRef<HTMLButtonElement, SpeedDialActionProps>(\n function SpeedDialAction(\n { icon, label, tooltipOpen, hideTooltip = false, onClick, disabled, className, ...props },\n ref,\n ) {\n const dial = useSpeedDial()\n const iconNode =\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? <Icon name={icon as IconName} /> : icon\n\n const button = (\n <IconButton\n ref={ref}\n rounded\n variant=\"contained\"\n color=\"surface\"\n size={dial?.size ?? 'sm'}\n disabled={disabled}\n aria-label={typeof label === 'string' ? label : undefined}\n className={clsx(styles.action, className)}\n onClick={(event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (dial?.closeOnClick) dial.requestClose()\n }}\n {...props}\n >\n {iconNode}\n </IconButton>\n )\n\n if (label == null || hideTooltip) return button\n\n const placement = dial?.placement ?? 'left'\n // persistent label: render a static label beside the button (no hover) — like MUI's tooltipOpen\n const persistent = tooltipOpen ?? dial?.persistentLabels ?? false\n if (persistent) {\n return (\n <span\n className={clsx(\n styles.actionWrap,\n placement === 'top' ? styles.labelTop : styles.labelLeft,\n )}\n >\n {button}\n <span className={styles.actionLabel}>{label}</span>\n </span>\n )\n }\n\n return (\n <Tooltip content={label} placement={placement}>\n {button}\n </Tooltip>\n )\n },\n)\n","import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport type { ThemeColor } from '../../theme'\nimport type { TooltipPlacement } from '../Tooltip'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { SpeedDialAction } from './SpeedDialAction'\nimport {\n SpeedDialContext,\n type SpeedDialActionSize,\n type SpeedDialContextValue,\n} from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type SpeedDialSize = 'sm' | 'md' | 'lg'\nexport type SpeedDialDirection = 'up' | 'down' | 'left' | 'right'\n\n/** The FAB size → the (smaller) action-button size. */\nconst ACTION_SIZE: Record<SpeedDialSize, SpeedDialActionSize> = { sm: 'sm', md: 'sm', lg: 'md' }\n/** Tooltip side per direction — labels sit left of a vertical dial, above a horizontal one. */\nconst TOOLTIP_PLACEMENT: Record<SpeedDialDirection, TooltipPlacement> = {\n up: 'left',\n down: 'left',\n left: 'top',\n right: 'top',\n}\n\n/** A data-driven action for the `actions` prop. */\nexport interface SpeedDialActionItem {\n /** Stable key (falls back to the index). */\n key?: string\n icon: IconName | ReactNode\n label?: ReactNode\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void\n disabled?: boolean\n}\n\nexport interface SpeedDialProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color' | 'onChange'> {\n /** Accessible label for the FAB (required — it's icon-only). */\n ariaLabel: string\n /** FAB icon. Defaults to `Add` (a `+`). */\n icon?: IconName | ReactNode\n /** Icon shown while open. Omit to rotate the `icon` 45° instead (a `+` becomes a `×`). */\n openIcon?: IconName | ReactNode\n /** Which way the actions fan out. Defaults to `up`. */\n direction?: SpeedDialDirection\n /** Theme palette token tinting the FAB. Defaults to `primary`. */\n color?: ThemeColor\n /** FAB size (actions render one step smaller). Defaults to `md`. */\n size?: SpeedDialSize\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Open on hover (also opens on click). Defaults to `true`. */\n openOnHover?: boolean\n /** Close the dial after an action is clicked. Defaults to `true`. */\n closeOnActionClick?: boolean\n /** Show every action's label persistently while open (no hover needed) — like MUI's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Data-driven actions — an alternative to `<SpeedDialAction>` children. */\n actions?: SpeedDialActionItem[]\n /** Disables the FAB (and hover-opening). */\n disabled?: boolean\n /** `<SpeedDialAction>` children (used when `actions` is not given). */\n children?: ReactNode\n}\n\n/**\n * A floating action button that reveals a set of related actions on hover / click — fanning out in\n * `direction` (`up` default). The FAB icon rotates 45° when open (a `+` → `×`) unless an `openIcon` is\n * given. Each `<SpeedDialAction>` is a small circular button with a tooltip label; supply them via the\n * data-driven `actions` prop or as children. Opens on hover (`openOnHover`) and click; closes on\n * outside-pointerdown, Escape (refocusing the FAB), or selecting an action. Controlled (`open` +\n * `onOpenChange`) or uncontrolled (`defaultOpen`). The ref points at the root; position it (e.g.\n * `fixed` bottom-right) via `style`/`className`. The FAB carries `aria-expanded`/`aria-controls`.\n */\nexport const SpeedDial = forwardRef<HTMLDivElement, SpeedDialProps>(function SpeedDial(\n {\n ariaLabel,\n icon = 'Add',\n openIcon,\n direction = 'up',\n color = 'primary',\n size = 'md',\n open,\n defaultOpen = false,\n onOpenChange,\n openOnHover = true,\n closeOnActionClick = true,\n tooltipOpen = false,\n actions,\n disabled = false,\n children,\n className,\n style,\n ...props\n },\n forwardedRef,\n) {\n const rootRef = useRef<HTMLDivElement | null>(null)\n const fabRef = useRef<HTMLButtonElement | null>(null)\n const actionsId = useId()\n\n const isControlled = open !== undefined\n const [internal, setInternal] = useState(defaultOpen)\n const isOpen = isControlled ? open : internal\n\n const setOpen = (next: boolean) => {\n if (!isControlled) setInternal(next)\n onOpenChange?.(next)\n }\n // keep a stable reference for the document listeners below\n const setOpenRef = useRef(setOpen)\n setOpenRef.current = setOpen\n\n // while open: close on outside pointerdown / Escape (Escape refocuses the FAB)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n if (rootRef.current && !rootRef.current.contains(event.target as Node)) {\n setOpenRef.current(false)\n }\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setOpenRef.current(false)\n fabRef.current?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen])\n\n const setRootRef = (node: HTMLDivElement | null) => {\n rootRef.current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n }\n\n const renderIcon = (value: IconName | ReactNode) =>\n typeof value === 'string' && ICON_NAME_SET.has(value) ? (\n <Icon name={value as IconName} />\n ) : (\n value\n )\n\n const ctx: SpeedDialContextValue = {\n size: ACTION_SIZE[size],\n placement: TOOLTIP_PLACEMENT[direction],\n closeOnClick: closeOnActionClick,\n persistentLabels: tooltipOpen,\n requestClose: () => setOpen(false),\n }\n\n const hoverProps =\n openOnHover && !disabled\n ? { onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false) }\n : {}\n\n return (\n <div\n ref={setRootRef}\n className={clsx(styles.speedDial, className)}\n style={style as CSSProperties}\n {...hoverProps}\n {...props}\n >\n <div\n id={actionsId}\n className={clsx(styles.actions, styles[direction])}\n data-open={isOpen ? 'true' : 'false'}\n >\n <SpeedDialContext.Provider value={ctx}>\n {actions\n ? actions.map((action, index) => (\n <SpeedDialAction\n key={action.key ?? index}\n icon={action.icon}\n label={action.label}\n onClick={action.onClick}\n disabled={action.disabled}\n />\n ))\n : children}\n </SpeedDialContext.Provider>\n </div>\n\n <IconButton\n ref={fabRef}\n rounded\n variant=\"contained\"\n color={color}\n size={size}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n aria-controls={actionsId}\n className={styles.fab}\n onClick={() => setOpen(!isOpen)}\n >\n <span className={clsx(styles.fabIcon, !openIcon && isOpen && styles.fabIconOpen)}>\n {isOpen && openIcon != null ? renderIcon(openIcon) : renderIcon(icon)}\n </span>\n </IconButton>\n </div>\n )\n})\n"],"names":["SpeedDialContext","createContext","useSpeedDial","useContext","ICON_NAME_SET","ICON_NAMES","SpeedDialAction","forwardRef","icon","label","tooltipOpen","hideTooltip","onClick","disabled","className","props","ref","dial","iconNode","jsx","Icon","button","IconButton","clsx","styles","event","placement","jsxs","Tooltip","ACTION_SIZE","TOOLTIP_PLACEMENT","SpeedDial","ariaLabel","openIcon","direction","color","size","open","defaultOpen","onOpenChange","openOnHover","closeOnActionClick","actions","children","style","forwardedRef","rootRef","useRef","fabRef","actionsId","useId","isControlled","internal","setInternal","useState","isOpen","setOpen","next","setOpenRef","useEffect","onPointerDown","onKeyDown","_a","setRootRef","node","renderIcon","value","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AAA,WAAA,CACC,IAAK0B,EACL,QAAO,GACP,QAAQ,YACR,MAAAb,EACA,KAAAC,EACA,SAAAvB,EACA,aAAYmB,EACZ,gBAAc,OACd,gBAAeuB,EACf,gBAAeN,EACf,UAAWzB,EAAO,IAClB,QAAS,IAAMgC,EAAQ,CAACD,CAAM,EAE9B,SAAApC,EAAAA,IAAC,QAAK,UAAWI,OAAKC,EAAO,QAAS,CAACS,GAAYsB,GAAU/B,EAAO,WAAW,EAC5E,SAAA+B,GAAUtB,GAAY,KAAOgC,EAAWhC,CAAQ,EAAIgC,EAAWzD,CAAI,CAAA,CACtE,CAAA,CAAA,CACF,CAAA,CAAA,CAGN,CAAC"}
1
+ {"version":3,"file":"SpeedDial-D6sO-9ES.cjs","sources":["../src/components/SpeedDial/speedDialContext.ts","../src/components/SpeedDial/SpeedDialAction.tsx","../src/components/SpeedDial/SpeedDial.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { TooltipPlacement } from '../Tooltip'\n\n/** Action button size — one step smaller than the dial's FAB. */\nexport type SpeedDialActionSize = 'sm' | 'md' | 'lg'\n\n/** Shared state a `<SpeedDial>` hands down to its `<SpeedDialAction>` children via context. */\nexport interface SpeedDialContextValue {\n /** Size for the action FABs. */\n size: SpeedDialActionSize\n /** Where each action's tooltip label sits (derived from the dial `direction`). */\n placement: TooltipPlacement\n /** Close the dial after an action is clicked. */\n closeOnClick: boolean\n /** Show every action's label persistently (no hover needed) while the dial is open. */\n persistentLabels: boolean\n /** Request the dial to close (called by an action on click). */\n requestClose: () => void\n}\n\nexport const SpeedDialContext = createContext<SpeedDialContextValue | null>(null)\n\n/** Read the surrounding `<SpeedDial>` (or `null` when an action is rendered standalone). */\nexport function useSpeedDial(): SpeedDialContextValue | null {\n return useContext(SpeedDialContext)\n}\n","import { forwardRef, type ButtonHTMLAttributes, type MouseEvent, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Tooltip } from '../Tooltip'\nimport { useSpeedDial } from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface SpeedDialActionProps extends Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'color'\n> {\n /** Action icon — a known `IconName` or any node. */\n icon: IconName | ReactNode\n /** Label shown as a tooltip beside the action (also its `aria-label` when a string). */\n label?: ReactNode\n /** Show the label persistently (no hover) while the dial is open — overrides the dial's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Hide the tooltip / persistent label (still used for `aria-label`). */\n hideTooltip?: boolean\n}\n\n/**\n * One action inside a `<SpeedDial>` — a small circular `IconButton` (surface-tinted) with a tooltip\n * `label`. It reads the dial via context for its size, tooltip placement and close-on-click; clicking\n * runs `onClick` then closes the dial. The ref points at the `<button>`.\n */\nexport const SpeedDialAction = forwardRef<HTMLButtonElement, SpeedDialActionProps>(\n function SpeedDialAction(\n { icon, label, tooltipOpen, hideTooltip = false, onClick, disabled, className, ...props },\n ref,\n ) {\n const dial = useSpeedDial()\n const iconNode =\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? <Icon name={icon as IconName} /> : icon\n\n const button = (\n <IconButton\n ref={ref}\n rounded\n variant=\"contained\"\n color=\"surface\"\n size={dial?.size ?? 'sm'}\n disabled={disabled}\n aria-label={typeof label === 'string' ? label : undefined}\n className={clsx(styles.action, className)}\n onClick={(event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (dial?.closeOnClick) dial.requestClose()\n }}\n {...props}\n >\n {iconNode}\n </IconButton>\n )\n\n if (label == null || hideTooltip) return button\n\n const placement = dial?.placement ?? 'left'\n // persistent label: render a static label beside the button (no hover) — like MUI's tooltipOpen\n const persistent = tooltipOpen ?? dial?.persistentLabels ?? false\n if (persistent) {\n return (\n <span\n className={clsx(\n styles.actionWrap,\n placement === 'top' ? styles.labelTop : styles.labelLeft,\n )}\n >\n {button}\n <span className={styles.actionLabel}>{label}</span>\n </span>\n )\n }\n\n return (\n <Tooltip content={label} placement={placement}>\n {button}\n </Tooltip>\n )\n },\n)\n","import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type MouseEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport type { ThemeColor } from '../../theme'\nimport type { TooltipPlacement } from '../Tooltip'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { SpeedDialAction } from './SpeedDialAction'\nimport {\n SpeedDialContext,\n type SpeedDialActionSize,\n type SpeedDialContextValue,\n} from './speedDialContext'\nimport styles from './SpeedDial.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type SpeedDialSize = 'sm' | 'md' | 'lg'\nexport type SpeedDialDirection = 'up' | 'down' | 'left' | 'right'\n\n/** The FAB size → the (smaller) action-button size. */\nconst ACTION_SIZE: Record<SpeedDialSize, SpeedDialActionSize> = { sm: 'sm', md: 'sm', lg: 'md' }\n/** Tooltip side per direction — labels sit left of a vertical dial, above a horizontal one. */\nconst TOOLTIP_PLACEMENT: Record<SpeedDialDirection, TooltipPlacement> = {\n up: 'left',\n down: 'left',\n left: 'top',\n right: 'top',\n}\n\n/** A data-driven action for the `actions` prop. */\nexport interface SpeedDialActionItem {\n /** Stable key (falls back to the index). */\n key?: string\n icon: IconName | ReactNode\n label?: ReactNode\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void\n disabled?: boolean\n}\n\nexport interface SpeedDialProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color' | 'onChange'> {\n /** Accessible label for the FAB (required — it's icon-only). */\n ariaLabel: string\n /** FAB icon. Defaults to `Add` (a `+`). */\n icon?: IconName | ReactNode\n /** Icon shown while open. Omit to rotate the `icon` 45° instead (a `+` becomes a `×`). */\n openIcon?: IconName | ReactNode\n /** Which way the actions fan out. Defaults to `up`. */\n direction?: SpeedDialDirection\n /** Theme palette token tinting the FAB. Defaults to `primary`. */\n color?: ThemeColor\n /** FAB size (actions render one step smaller). Defaults to `md`. */\n size?: SpeedDialSize\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Open on hover (also opens on click). Defaults to `true`. */\n openOnHover?: boolean\n /** Close the dial after an action is clicked. Defaults to `true`. */\n closeOnActionClick?: boolean\n /** Show every action's label persistently while open (no hover needed) — like MUI's `tooltipOpen`. */\n tooltipOpen?: boolean\n /** Data-driven actions — an alternative to `<SpeedDialAction>` children. */\n actions?: SpeedDialActionItem[]\n /** Disables the FAB (and hover-opening). */\n disabled?: boolean\n /** `<SpeedDialAction>` children (used when `actions` is not given). */\n children?: ReactNode\n}\n\n/**\n * A floating action button that reveals a set of related actions on hover / click — fanning out in\n * `direction` (`up` default). The FAB icon rotates 45° when open (a `+` → `×`) unless an `openIcon` is\n * given. Each `<SpeedDialAction>` is a small circular button with a tooltip label; supply them via the\n * data-driven `actions` prop or as children. Opens on hover (`openOnHover`) and click; closes on\n * outside-pointerdown, Escape (refocusing the FAB), or selecting an action. Controlled (`open` +\n * `onOpenChange`) or uncontrolled (`defaultOpen`). The ref points at the root; position it (e.g.\n * `fixed` bottom-right) via `style`/`className`. The FAB carries `aria-expanded`/`aria-controls`.\n */\nexport const SpeedDial = forwardRef<HTMLDivElement, SpeedDialProps>(function SpeedDial(\n {\n ariaLabel,\n icon = 'Add',\n openIcon,\n direction = 'up',\n color = 'primary',\n size = 'md',\n open,\n defaultOpen = false,\n onOpenChange,\n openOnHover = true,\n closeOnActionClick = true,\n tooltipOpen = false,\n actions,\n disabled = false,\n children,\n className,\n style,\n ...props\n },\n forwardedRef,\n) {\n const rootRef = useRef<HTMLDivElement | null>(null)\n const fabRef = useRef<HTMLButtonElement | null>(null)\n const actionsId = useId()\n\n const isControlled = open !== undefined\n const [internal, setInternal] = useState(defaultOpen)\n const isOpen = isControlled ? open : internal\n\n const setOpen = (next: boolean) => {\n if (!isControlled) setInternal(next)\n onOpenChange?.(next)\n }\n // keep a stable reference for the document listeners below\n const setOpenRef = useRef(setOpen)\n setOpenRef.current = setOpen\n\n // while open: close on outside pointerdown / Escape (Escape refocuses the FAB)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n if (rootRef.current && !rootRef.current.contains(event.target as Node)) {\n setOpenRef.current(false)\n }\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setOpenRef.current(false)\n fabRef.current?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen])\n\n const setRootRef = (node: HTMLDivElement | null) => {\n rootRef.current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n }\n\n const renderIcon = (value: IconName | ReactNode) =>\n typeof value === 'string' && ICON_NAME_SET.has(value) ? (\n <Icon name={value as IconName} />\n ) : (\n value\n )\n\n const ctx: SpeedDialContextValue = {\n size: ACTION_SIZE[size],\n placement: TOOLTIP_PLACEMENT[direction],\n closeOnClick: closeOnActionClick,\n persistentLabels: tooltipOpen,\n requestClose: () => setOpen(false),\n }\n\n const hoverProps =\n openOnHover && !disabled\n ? { onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false) }\n : {}\n\n return (\n <div\n ref={setRootRef}\n className={clsx(styles.speedDial, className)}\n style={style as CSSProperties}\n {...hoverProps}\n {...props}\n >\n <div\n id={actionsId}\n className={clsx(styles.actions, styles[direction])}\n data-open={isOpen ? 'true' : 'false'}\n >\n <SpeedDialContext.Provider value={ctx}>\n {actions\n ? actions.map((action, index) => (\n <SpeedDialAction\n key={action.key ?? index}\n icon={action.icon}\n label={action.label}\n onClick={action.onClick}\n disabled={action.disabled}\n />\n ))\n : children}\n </SpeedDialContext.Provider>\n </div>\n\n <IconButton\n ref={fabRef}\n rounded\n variant=\"contained\"\n color={color}\n size={size}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n aria-controls={actionsId}\n className={styles.fab}\n onClick={() => setOpen(!isOpen)}\n >\n <span className={clsx(styles.fabIcon, !openIcon && isOpen && styles.fabIconOpen)}>\n {isOpen && openIcon != null ? renderIcon(openIcon) : renderIcon(icon)}\n </span>\n </IconButton>\n </div>\n )\n})\n"],"names":["SpeedDialContext","createContext","useSpeedDial","useContext","ICON_NAME_SET","ICON_NAMES","SpeedDialAction","forwardRef","icon","label","tooltipOpen","hideTooltip","onClick","disabled","className","props","ref","dial","iconNode","jsx","Icon","button","IconButton","clsx","styles","event","placement","jsxs","Tooltip","ACTION_SIZE","TOOLTIP_PLACEMENT","SpeedDial","ariaLabel","openIcon","direction","color","size","open","defaultOpen","onOpenChange","openOnHover","closeOnActionClick","actions","children","style","forwardedRef","rootRef","useRef","fabRef","actionsId","useId","isControlled","internal","setInternal","useState","isOpen","setOpen","next","setOpenRef","useEffect","onPointerDown","onKeyDown","_a","setRootRef","node","renderIcon","value","ctx","hoverProps","action","index"],"mappings":"qOAoBaA,EAAmBC,EAAAA,cAA4C,IAAI,EAGzE,SAASC,GAA6C,CAC3D,OAAOC,EAAAA,WAAWH,CAAgB,CACpC,udChBMI,GAAgB,IAAI,IAAYC,YAAU,EAqBnCC,EAAkBC,EAAAA,WAC7B,SACE,CAAE,KAAAC,EAAM,MAAAC,EAAO,YAAAC,EAAa,YAAAC,EAAc,GAAO,QAAAC,EAAS,SAAAC,EAAU,UAAAC,EAAW,GAAGC,CAAA,EAClFC,EACA,CACA,MAAMC,EAAOf,EAAA,EACPgB,EACJ,OAAOV,GAAS,UAAYJ,GAAc,IAAII,CAAI,EAAIW,EAAAA,IAACC,EAAAA,KAA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,9 @@
1
1
  import { jsxs as b, jsx as r, Fragment as H } from "react/jsx-runtime";
2
2
  import { forwardRef as tt, useCallback as y, useState as nt, useRef as p, useEffect as I } from "react";
3
3
  import { clsx as L } from "clsx";
4
- import { a as et } from "./names-D8ABK2Wk.js";
5
- import { I as O } from "./Icon-CophpkHo.js";
6
- import { j as ot } from "./ConfigProvider-DDuIJSM7.js";
4
+ import { a as et } from "./names-r21QPjcU.js";
5
+ import { I as O } from "./Icon-DaTvzLBu.js";
6
+ import { j as ot } from "./ConfigProvider-DT0yrgmd.js";
7
7
  const rt = "_root_1xfvk_2", ct = "_list_1xfvk_5", lt = "_horizontal_1xfvk_11", st = "_vertical_1xfvk_24", at = "_sm_1xfvk_29", it = "_md_1xfvk_34", dt = "_lg_1xfvk_39", ft = "_step_1xfvk_47", ut = "_disabled_1xfvk_64", _t = "_main_1xfvk_69", mt = "_indicator_1xfvk_99", vt = "_number_1xfvk_125", ht = "_completed_1xfvk_130", bt = "_active_1xfvk_136", pt = "_error_1xfvk_144", xt = "_text_1xfvk_151", wt = "_label_1xfvk_167", kt = "_description_1xfvk_181", Nt = "_optional_1xfvk_186", gt = "_connector_1xfvk_193", yt = "_done_1xfvk_198", It = "_panel_1xfvk_224", Lt = "_stepContent_1xfvk_228", e = {
8
8
  root: rt,
9
9
  list: ct,
@@ -162,4 +162,4 @@ const rt = "_root_1xfvk_2", ct = "_list_1xfvk_5", lt = "_horizontal_1xfvk_11", s
162
162
  export {
163
163
  Pt as S
164
164
  };
165
- //# sourceMappingURL=Stepper-BxGrP6JZ.js.map
165
+ //# sourceMappingURL=Stepper-BaEOUnYe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Stepper-BxGrP6JZ.js","sources":["../src/components/Stepper/Stepper.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useStepQueryKey, type ThemeColor } from '../../theme'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport styles from './Stepper.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type StepperOrientation = 'horizontal' | 'vertical'\nexport type StepperSize = 'sm' | 'md' | 'lg'\n\nexport interface StepItem {\n /** Step label. */\n label?: ReactNode\n /** Muted secondary line under the label. */\n description?: ReactNode\n /** Muted caption under the label (e.g. `\"Optional\"`). */\n optional?: ReactNode\n /** Override the step's number indicator with an icon — a known `IconName` or any node. */\n icon?: IconName | ReactNode\n /** Force the **completed** look regardless of the active step (e.g. an already-saved step). */\n completed?: boolean\n /** Marks the step **invalid** — a red indicator + label (e.g. its form section failed validation). */\n error?: boolean\n /** Disables the step — dimmed, (when clickable) not selectable, and skipped by the URL restore. */\n disabled?: boolean\n /**\n * Panel content rendered while this step is active — **below the strip** in horizontal mode, and\n * **inline under the step** (indented beside the rail) in vertical mode. Optional.\n */\n content?: ReactNode\n}\n\nexport interface StepperProps {\n /** The steps, in order. */\n steps: StepItem[]\n /**\n * Controlled current step index (**0-based**). Steps before it read **completed**, the one at it is\n * **active**, and those after it are **upcoming**. Omit for uncontrolled (see `defaultStep`).\n */\n activeStep?: number\n /**\n * Initial step index (uncontrolled). Falls back to the URL query (when URL sync is active and the\n * param is present) and otherwise the first enabled step.\n */\n defaultStep?: number\n /**\n * Fires with the next step index whenever the stepper itself changes the step — a clicked step head,\n * or a Back/Forward `popstate` restore. In controlled mode apply it to your `activeStep` state.\n */\n onStepChange?: (index: number) => void\n /**\n * **Opt-in** URL sync — **off by default** (the URL is never touched when omitted). Pass the bare\n * prop (**`queryKey`** / `true`) to sync the active step under the configured `keys.stepQueryKey`\n * (else `'step'`), or a **string** for a custom param name. The URL value is **1-based**\n * (`?step=2` = index 1) and a page refresh restores it. Two synced steppers on one page need\n * distinct keys.\n */\n queryKey?: boolean | string\n /**\n * Push a history entry on each step change, so the browser **Back** button returns to the previous\n * step. Defaults to `false` — step changes **replace** the URL, so Back leaves the page instead of\n * stepping back through the wizard (and `popstate` still restores a step when one is in the query).\n */\n pushHistory?: boolean\n /**\n * Layout direction. `horizontal` (default) centers each label **under** its circle and **scrolls\n * sideways** when the steps don't fit (so it fits a phone as-is); `vertical` stacks the steps along\n * a rail connector.\n */\n orientation?: StepperOrientation\n /** Preset size. Defaults to `'md'`. */\n size?: StepperSize\n /** Theme palette token tinting the active / completed steps. Defaults to `'primary'`. */\n color?: ThemeColor\n /**\n * Makes steps **clickable** — each step head becomes a `<button>` that fires this with the step index\n * (a `disabled` step never fires); an uncontrolled stepper also selects the clicked step itself. Omit\n * for a display-only progress indicator.\n */\n onStepClick?: (index: number) => void\n /** Accessible label for the stepper list. */\n 'aria-label'?: string\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A step progress indicator. Data-driven via `steps` (each: `label`, `description`, `optional`, `icon`,\n * `completed`, `error`, `disabled`, `content`) — controlled (`activeStep`, 0-based) or uncontrolled\n * (`defaultStep`). **Opt-in URL sync:** pass **`queryKey`** (bare/`true` = the configured\n * `keys.stepQueryKey`, else `'step'`; or a custom string) and the active step syncs to that query param\n * (**1-based** — `?step=2`) so a refresh restores it; with no `queryKey` the URL is never touched.\n * Synced step changes **replace** the URL (Back doesn't walk the wizard); pass **`pushHistory`** to\n * step back with Back.\n * Horizontal (labels centered under the circles) or `vertical` (a rail); when the horizontal steps\n * don't fit, the strip **scrolls sideways** (scrollbar hidden, the active step kept in view) — so it\n * fits a phone as-is. The active step's **`content`** renders below the strip (horizontal) or inline\n * under the step (vertical). Pass **`onStepClick`** to make the steps navigable. Tinted by `color` via\n * the shared `--tz-btn-rgb` pattern; the list is an `<ol>` with `aria-current=\"step\"` on the active step.\n */\nexport const Stepper = forwardRef<HTMLDivElement, StepperProps>(function Stepper(\n {\n steps,\n activeStep,\n defaultStep,\n onStepChange,\n queryKey,\n pushHistory = false,\n orientation = 'horizontal',\n size = 'md',\n color = 'primary',\n onStepClick,\n 'aria-label': ariaLabel,\n className,\n style,\n },\n ref,\n) {\n const vertical = orientation === 'vertical'\n const clickable = onStepClick != null\n\n // resolve the URL-sync key — OPT-IN: omitted/false = no sync (URL untouched); the bare/`true` form\n // uses the configured default (`keys.stepQueryKey`, else 'step'); a string is a custom param name\n const stepQueryKey = useStepQueryKey()\n const syncKey = queryKey === true ? stepQueryKey : queryKey || undefined\n\n const isSelectable = useCallback(\n (i: number | null | undefined): i is number =>\n i != null && Number.isInteger(i) && i >= 0 && i < steps.length && !steps[i].disabled,\n [steps],\n )\n\n // the URL carries the step 1-based (`?step=2` = index 1) — human-friendly, like Table's page param\n const readQuery = useCallback((): number | null => {\n if (!syncKey || typeof window === 'undefined') return null\n const raw = new URLSearchParams(window.location.search).get(syncKey)\n return raw != null && /^\\d+$/.test(raw) ? Number(raw) - 1 : null\n }, [syncKey])\n\n const firstEnabled = Math.max(\n steps.findIndex((s) => !s.disabled),\n 0,\n )\n\n const [internal, setInternal] = useState<number>(() => {\n const q = readQuery()\n if (isSelectable(q)) return q\n return isSelectable(defaultStep) ? defaultStep : firstEnabled\n })\n const isControlled = activeStep !== undefined\n // controlled mode renders the given index verbatim (even past the last step — the \"all completed\"\n // pattern); only the URL/popstate restores are gated by `isSelectable`\n const active = isControlled ? activeStep : internal\n\n // keep the latest active / onStepChange / push-intent for the stable effects + popstate listener\n const activeRef = useRef(active)\n activeRef.current = active\n const onStepChangeRef = useRef(onStepChange)\n onStepChangeRef.current = onStepChange\n const pushIntent = useRef(false)\n\n const writeQuery = useCallback(\n (next: number, push: boolean) => {\n if (!syncKey || typeof window === 'undefined') return\n const params = new URLSearchParams(window.location.search)\n const value = String(next + 1)\n if (params.get(syncKey) === value) return\n params.set(syncKey, value)\n const url = `${window.location.pathname}?${params.toString()}${window.location.hash}`\n window.history[push ? 'pushState' : 'replaceState'](window.history.state, '', url)\n },\n [syncKey],\n )\n\n const select = (next: number) => {\n if (next === activeRef.current) return\n pushIntent.current = true\n if (!isControlled) setInternal(next)\n onStepChange?.(next)\n }\n\n // mirror the active step into the URL whenever it changes (and on mount = canonicalize). A\n // user-driven change `push`es when `pushHistory`; programmatic / popstate changes just `replace`.\n useEffect(() => {\n if (!syncKey || typeof window === 'undefined') return\n // an out-of-range active (e.g. `steps.length` = \"all done\") isn't a step — leave the URL alone\n if (!Number.isInteger(active) || active < 0 || active >= steps.length) return\n const push = pushIntent.current && pushHistory\n pushIntent.current = false\n writeQuery(active, push)\n }, [syncKey, active, pushHistory, writeQuery, steps.length])\n\n // Back/Forward → restore the step from the query\n useEffect(() => {\n if (!syncKey || typeof window === 'undefined') return\n const onPopState = () => {\n const q = readQuery()\n if (isSelectable(q) && q !== activeRef.current) {\n if (activeStep === undefined) setInternal(q)\n onStepChangeRef.current?.(q)\n }\n }\n window.addEventListener('popstate', onPopState)\n return () => window.removeEventListener('popstate', onPopState)\n }, [syncKey, readQuery, isSelectable, activeStep])\n\n const activeContent = steps[active]?.content\n\n // when the horizontal strip overflows (scrolls sideways), keep the active step in view — by moving\n // the strip's own scrollLeft only. (scrollIntoView would also scroll every scrollable ancestor —\n // i.e. the page itself — yanking the viewport down to the stepper on mount.)\n const listRef = useRef<HTMLOListElement | null>(null)\n useEffect(() => {\n if (orientation === 'vertical') return // the vertical rail never scrolls sideways\n const list = listRef.current\n const el = list?.children[active] as HTMLElement | undefined\n if (!list || !el) return\n const listRect = list.getBoundingClientRect()\n const elRect = el.getBoundingClientRect()\n const left = elRect.left - listRect.left + list.scrollLeft\n const right = left + elRect.width\n if (left < list.scrollLeft) list.scrollLeft = left\n else if (right > list.scrollLeft + list.clientWidth) list.scrollLeft = right - list.clientWidth\n }, [active, orientation])\n\n const renderIcon = (icon: StepItem['icon']) =>\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} size={size} />\n ) : (\n icon\n )\n\n return (\n <div\n ref={ref}\n className={clsx(styles.root, styles[orientation], styles[size], className)}\n style={\n {\n '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`,\n '--tz-btn-on': `var(--tz-color-${color}-contrast, #fff)`,\n ...style,\n } as CSSProperties\n }\n >\n <ol ref={listRef} aria-label={ariaLabel} className={styles.list}>\n {steps.map((step, i) => {\n const isError = !!step.error\n const isCompleted = !isError && (step.completed || i < active)\n const isActive = !isError && !isCompleted && i === active\n const state = isError\n ? 'error'\n : isCompleted\n ? 'completed'\n : isActive\n ? 'active'\n : 'upcoming'\n const isLast = i === steps.length - 1\n\n const icon = renderIcon(step.icon)\n const indicator =\n icon != null ? (\n icon\n ) : isCompleted ? (\n <Icon name=\"Check\" size={size} />\n ) : (\n <span className={styles.number}>{i + 1}</span>\n )\n\n const hasText = step.label != null || step.description != null || step.optional != null\n const head = (\n <>\n <span\n className={styles.indicator}\n aria-hidden={icon == null && !isCompleted ? undefined : true}\n >\n {indicator}\n </span>\n {hasText && (\n <span className={styles.text}>\n {step.label != null && <span className={styles.label}>{step.label}</span>}\n {step.description != null && (\n <span className={styles.description}>{step.description}</span>\n )}\n {step.optional != null && (\n <span className={styles.optional}>{step.optional}</span>\n )}\n </span>\n )}\n </>\n )\n\n return (\n <li\n key={i}\n className={clsx(styles.step, styles[state], step.disabled && styles.disabled)}\n >\n {clickable ? (\n <button\n type=\"button\"\n className={styles.main}\n disabled={step.disabled}\n aria-current={isActive ? 'step' : undefined}\n onClick={() => {\n onStepClick?.(i)\n select(i)\n }}\n >\n {head}\n </button>\n ) : (\n <div className={styles.main} aria-current={isActive ? 'step' : undefined}>\n {head}\n </div>\n )}\n {!isLast && (\n <span\n className={clsx(styles.connector, i < active && styles.done)}\n aria-hidden=\"true\"\n />\n )}\n {/* vertical: the active step's content sits inline, indented beside the rail */}\n {vertical && i === active && step.content != null && (\n <div className={styles.stepContent}>{step.content}</div>\n )}\n </li>\n )\n })}\n </ol>\n {/* horizontal: the active step's content renders as a panel below the strip */}\n {!vertical && activeContent != null && <div className={styles.panel}>{activeContent}</div>}\n </div>\n )\n})\n"],"names":["ICON_NAME_SET","ICON_NAMES","Stepper","forwardRef","steps","activeStep","defaultStep","onStepChange","queryKey","pushHistory","orientation","size","color","onStepClick","ariaLabel","className","style","ref","vertical","clickable","stepQueryKey","useStepQueryKey","syncKey","isSelectable","useCallback","i","readQuery","raw","firstEnabled","s","internal","setInternal","useState","q","isControlled","active","activeRef","useRef","onStepChangeRef","pushIntent","writeQuery","next","push","params","value","url","select","useEffect","onPopState","_a","activeContent","listRef","list","el","listRect","elRect","left","right","renderIcon","icon","jsx","Icon","jsxs","clsx","styles","step","isError","isCompleted","isActive","state","isLast","indicator","hasText","head","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAeMA,KAAgB,IAAI,IAAYC,EAAU,GA+FnCC,KAAUC,GAAyC,SAC9D;AAAA,EACE,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,aAAAC,IAAc;AAAA,EACd,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,aAAAC;AAAA,EACA,cAAcC;AAAA,EACd,WAAAC;AAAA,EACA,OAAAC;AACF,GACAC,GACA;;AACA,QAAMC,IAAWR,MAAgB,YAC3BS,IAAYN,KAAe,MAI3BO,IAAeC,GAAA,GACfC,IAAUd,MAAa,KAAOY,IAAeZ,KAAY,QAEzDe,IAAeC;AAAA,IACnB,CAACC,MACCA,KAAK,QAAQ,OAAO,UAAUA,CAAC,KAAKA,KAAK,KAAKA,IAAIrB,EAAM,UAAU,CAACA,EAAMqB,CAAC,EAAE;AAAA,IAC9E,CAACrB,CAAK;AAAA,EAAA,GAIFsB,IAAYF,EAAY,MAAqB;AACjD,QAAI,CAACF,KAAW,OAAO,SAAW,IAAa,QAAO;AACtD,UAAMK,IAAM,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAAE,IAAIL,CAAO;AACnE,WAAOK,KAAO,QAAQ,QAAQ,KAAKA,CAAG,IAAI,OAAOA,CAAG,IAA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A;AAAA,YAAA;AAAA,YA7B/CxC;AAAA,UAAA;AAAA,QAiCX,CAAC,EAAA,CACH;AAAA,QAEC,CAACP,KAAYgC,KAAiB,0BAAS,OAAA,EAAI,WAAWc,EAAO,OAAQ,UAAAd,EAAA,CAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG1F,CAAC;"}
1
+ {"version":3,"file":"Stepper-BaEOUnYe.js","sources":["../src/components/Stepper/Stepper.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useStepQueryKey, type ThemeColor } from '../../theme'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport styles from './Stepper.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type StepperOrientation = 'horizontal' | 'vertical'\nexport type StepperSize = 'sm' | 'md' | 'lg'\n\nexport interface StepItem {\n /** Step label. */\n label?: ReactNode\n /** Muted secondary line under the label. */\n description?: ReactNode\n /** Muted caption under the label (e.g. `\"Optional\"`). */\n optional?: ReactNode\n /** Override the step's number indicator with an icon — a known `IconName` or any node. */\n icon?: IconName | ReactNode\n /** Force the **completed** look regardless of the active step (e.g. an already-saved step). */\n completed?: boolean\n /** Marks the step **invalid** — a red indicator + label (e.g. its form section failed validation). */\n error?: boolean\n /** Disables the step — dimmed, (when clickable) not selectable, and skipped by the URL restore. */\n disabled?: boolean\n /**\n * Panel content rendered while this step is active — **below the strip** in horizontal mode, and\n * **inline under the step** (indented beside the rail) in vertical mode. Optional.\n */\n content?: ReactNode\n}\n\nexport interface StepperProps {\n /** The steps, in order. */\n steps: StepItem[]\n /**\n * Controlled current step index (**0-based**). Steps before it read **completed**, the one at it is\n * **active**, and those after it are **upcoming**. Omit for uncontrolled (see `defaultStep`).\n */\n activeStep?: number\n /**\n * Initial step index (uncontrolled). Falls back to the URL query (when URL sync is active and the\n * param is present) and otherwise the first enabled step.\n */\n defaultStep?: number\n /**\n * Fires with the next step index whenever the stepper itself changes the step — a clicked step head,\n * or a Back/Forward `popstate` restore. In controlled mode apply it to your `activeStep` state.\n */\n onStepChange?: (index: number) => void\n /**\n * **Opt-in** URL sync — **off by default** (the URL is never touched when omitted). Pass the bare\n * prop (**`queryKey`** / `true`) to sync the active step under the configured `keys.stepQueryKey`\n * (else `'step'`), or a **string** for a custom param name. The URL value is **1-based**\n * (`?step=2` = index 1) and a page refresh restores it. Two synced steppers on one page need\n * distinct keys.\n */\n queryKey?: boolean | string\n /**\n * Push a history entry on each step change, so the browser **Back** button returns to the previous\n * step. Defaults to `false` — step changes **replace** the URL, so Back leaves the page instead of\n * stepping back through the wizard (and `popstate` still restores a step when one is in the query).\n */\n pushHistory?: boolean\n /**\n * Layout direction. `horizontal` (default) centers each label **under** its circle and **scrolls\n * sideways** when the steps don't fit (so it fits a phone as-is); `vertical` stacks the steps along\n * a rail connector.\n */\n orientation?: StepperOrientation\n /** Preset size. Defaults to `'md'`. */\n size?: StepperSize\n /** Theme palette token tinting the active / completed steps. Defaults to `'primary'`. */\n color?: ThemeColor\n /**\n * Makes steps **clickable** — each step head becomes a `<button>` that fires this with the step index\n * (a `disabled` step never fires); an uncontrolled stepper also selects the clicked step itself. Omit\n * for a display-only progress indicator.\n */\n onStepClick?: (index: number) => void\n /** Accessible label for the stepper list. */\n 'aria-label'?: string\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A step progress indicator. Data-driven via `steps` (each: `label`, `description`, `optional`, `icon`,\n * `completed`, `error`, `disabled`, `content`) — controlled (`activeStep`, 0-based) or uncontrolled\n * (`defaultStep`). **Opt-in URL sync:** pass **`queryKey`** (bare/`true` = the configured\n * `keys.stepQueryKey`, else `'step'`; or a custom string) and the active step syncs to that query param\n * (**1-based** — `?step=2`) so a refresh restores it; with no `queryKey` the URL is never touched.\n * Synced step changes **replace** the URL (Back doesn't walk the wizard); pass **`pushHistory`** to\n * step back with Back.\n * Horizontal (labels centered under the circles) or `vertical` (a rail); when the horizontal steps\n * don't fit, the strip **scrolls sideways** (scrollbar hidden, the active step kept in view) — so it\n * fits a phone as-is. The active step's **`content`** renders below the strip (horizontal) or inline\n * under the step (vertical). Pass **`onStepClick`** to make the steps navigable. Tinted by `color` via\n * the shared `--tz-btn-rgb` pattern; the list is an `<ol>` with `aria-current=\"step\"` on the active step.\n */\nexport const Stepper = forwardRef<HTMLDivElement, StepperProps>(function Stepper(\n {\n steps,\n activeStep,\n defaultStep,\n onStepChange,\n queryKey,\n pushHistory = false,\n orientation = 'horizontal',\n size = 'md',\n color = 'primary',\n onStepClick,\n 'aria-label': ariaLabel,\n className,\n style,\n },\n ref,\n) {\n const vertical = orientation === 'vertical'\n const clickable = onStepClick != null\n\n // resolve the URL-sync key — OPT-IN: omitted/false = no sync (URL untouched); the bare/`true` form\n // uses the configured default (`keys.stepQueryKey`, else 'step'); a string is a custom param name\n const stepQueryKey = useStepQueryKey()\n const syncKey = queryKey === true ? stepQueryKey : queryKey || undefined\n\n const isSelectable = useCallback(\n (i: number | null | undefined): i is number =>\n i != null && Number.isInteger(i) && i >= 0 && i < steps.length && !steps[i].disabled,\n [steps],\n )\n\n // the URL carries the step 1-based (`?step=2` = index 1) — human-friendly, like Table's page param\n const readQuery = useCallback((): number | null => {\n if (!syncKey || typeof window === 'undefined') return null\n const raw = new URLSearchParams(window.location.search).get(syncKey)\n return raw != null && /^\\d+$/.test(raw) ? Number(raw) - 1 : null\n }, [syncKey])\n\n const firstEnabled = Math.max(\n steps.findIndex((s) => !s.disabled),\n 0,\n )\n\n const [internal, setInternal] = useState<number>(() => {\n const q = readQuery()\n if (isSelectable(q)) return q\n return isSelectable(defaultStep) ? defaultStep : firstEnabled\n })\n const isControlled = activeStep !== undefined\n // controlled mode renders the given index verbatim (even past the last step — the \"all completed\"\n // pattern); only the URL/popstate restores are gated by `isSelectable`\n const active = isControlled ? activeStep : internal\n\n // keep the latest active / onStepChange / push-intent for the stable effects + popstate listener\n const activeRef = useRef(active)\n activeRef.current = active\n const onStepChangeRef = useRef(onStepChange)\n onStepChangeRef.current = onStepChange\n const pushIntent = useRef(false)\n\n const writeQuery = useCallback(\n (next: number, push: boolean) => {\n if (!syncKey || typeof window === 'undefined') return\n const params = new URLSearchParams(window.location.search)\n const value = String(next + 1)\n if (params.get(syncKey) === value) return\n params.set(syncKey, value)\n const url = `${window.location.pathname}?${params.toString()}${window.location.hash}`\n window.history[push ? 'pushState' : 'replaceState'](window.history.state, '', url)\n },\n [syncKey],\n )\n\n const select = (next: number) => {\n if (next === activeRef.current) return\n pushIntent.current = true\n if (!isControlled) setInternal(next)\n onStepChange?.(next)\n }\n\n // mirror the active step into the URL whenever it changes (and on mount = canonicalize). A\n // user-driven change `push`es when `pushHistory`; programmatic / popstate changes just `replace`.\n useEffect(() => {\n if (!syncKey || typeof window === 'undefined') return\n // an out-of-range active (e.g. `steps.length` = \"all done\") isn't a step — leave the URL alone\n if (!Number.isInteger(active) || active < 0 || active >= steps.length) return\n const push = pushIntent.current && pushHistory\n pushIntent.current = false\n writeQuery(active, push)\n }, [syncKey, active, pushHistory, writeQuery, steps.length])\n\n // Back/Forward → restore the step from the query\n useEffect(() => {\n if (!syncKey || typeof window === 'undefined') return\n const onPopState = () => {\n const q = readQuery()\n if (isSelectable(q) && q !== activeRef.current) {\n if (activeStep === undefined) setInternal(q)\n onStepChangeRef.current?.(q)\n }\n }\n window.addEventListener('popstate', onPopState)\n return () => window.removeEventListener('popstate', onPopState)\n }, [syncKey, readQuery, isSelectable, activeStep])\n\n const activeContent = steps[active]?.content\n\n // when the horizontal strip overflows (scrolls sideways), keep the active step in view — by moving\n // the strip's own scrollLeft only. (scrollIntoView would also scroll every scrollable ancestor —\n // i.e. the page itself — yanking the viewport down to the stepper on mount.)\n const listRef = useRef<HTMLOListElement | null>(null)\n useEffect(() => {\n if (orientation === 'vertical') return // the vertical rail never scrolls sideways\n const list = listRef.current\n const el = list?.children[active] as HTMLElement | undefined\n if (!list || !el) return\n const listRect = list.getBoundingClientRect()\n const elRect = el.getBoundingClientRect()\n const left = elRect.left - listRect.left + list.scrollLeft\n const right = left + elRect.width\n if (left < list.scrollLeft) list.scrollLeft = left\n else if (right > list.scrollLeft + list.clientWidth) list.scrollLeft = right - list.clientWidth\n }, [active, orientation])\n\n const renderIcon = (icon: StepItem['icon']) =>\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} size={size} />\n ) : (\n icon\n )\n\n return (\n <div\n ref={ref}\n className={clsx(styles.root, styles[orientation], styles[size], className)}\n style={\n {\n '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`,\n '--tz-btn-on': `var(--tz-color-${color}-contrast, #fff)`,\n ...style,\n } as CSSProperties\n }\n >\n <ol ref={listRef} aria-label={ariaLabel} className={styles.list}>\n {steps.map((step, i) => {\n const isError = !!step.error\n const isCompleted = !isError && (step.completed || i < active)\n const isActive = !isError && !isCompleted && i === active\n const state = isError\n ? 'error'\n : isCompleted\n ? 'completed'\n : isActive\n ? 'active'\n : 'upcoming'\n const isLast = i === steps.length - 1\n\n const icon = renderIcon(step.icon)\n const indicator =\n icon != null ? (\n icon\n ) : isCompleted ? (\n <Icon name=\"Check\" size={size} />\n ) : (\n <span className={styles.number}>{i + 1}</span>\n )\n\n const hasText = step.label != null || step.description != null || step.optional != null\n const head = (\n <>\n <span\n className={styles.indicator}\n aria-hidden={icon == null && !isCompleted ? undefined : true}\n >\n {indicator}\n </span>\n {hasText && (\n <span className={styles.text}>\n {step.label != null && <span className={styles.label}>{step.label}</span>}\n {step.description != null && (\n <span className={styles.description}>{step.description}</span>\n )}\n {step.optional != null && (\n <span className={styles.optional}>{step.optional}</span>\n )}\n </span>\n )}\n </>\n )\n\n return (\n <li\n key={i}\n className={clsx(styles.step, styles[state], step.disabled && styles.disabled)}\n >\n {clickable ? (\n <button\n type=\"button\"\n className={styles.main}\n disabled={step.disabled}\n aria-current={isActive ? 'step' : undefined}\n onClick={() => {\n onStepClick?.(i)\n select(i)\n }}\n >\n {head}\n </button>\n ) : (\n <div className={styles.main} aria-current={isActive ? 'step' : undefined}>\n {head}\n </div>\n )}\n {!isLast && (\n <span\n className={clsx(styles.connector, i < active && styles.done)}\n aria-hidden=\"true\"\n />\n )}\n {/* vertical: the active step's content sits inline, indented beside the rail */}\n {vertical && i === active && step.content != null && (\n <div className={styles.stepContent}>{step.content}</div>\n )}\n </li>\n )\n })}\n </ol>\n {/* horizontal: the active step's content renders as a panel below the strip */}\n {!vertical && activeContent != null && <div className={styles.panel}>{activeContent}</div>}\n </div>\n )\n})\n"],"names":["ICON_NAME_SET","ICON_NAMES","Stepper","forwardRef","steps","activeStep","defaultStep","onStepChange","queryKey","pushHistory","orientation","size","color","onStepClick","ariaLabel","className","style","ref","vertical","clickable","stepQueryKey","useStepQueryKey","syncKey","isSelectable","useCallback","i","readQuery","raw","firstEnabled","s","internal","setInternal","useState","q","isControlled","active","activeRef","useRef","onStepChangeRef","pushIntent","writeQuery","next","push","params","value","url","select","useEffect","onPopState","_a","activeContent","listRef","list","el","listRect","elRect","left","right","renderIcon","icon","jsx","Icon","jsxs","clsx","styles","step","isError","isCompleted","isActive","state","isLast","indicator","hasText","head","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAeMA,KAAgB,IAAI,IAAYC,EAAU,GA+FnCC,KAAUC,GAAyC,SAC9D;AAAA,EACE,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,aAAAC,IAAc;AAAA,EACd,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,aAAAC;AAAA,EACA,cAAcC;AAAA,EACd,WAAAC;AAAA,EACA,OAAAC;AACF,GACAC,GACA;;AACA,QAAMC,IAAWR,MAAgB,YAC3BS,IAAYN,KAAe,MAI3BO,IAAeC,GAAA,GACfC,IAAU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A;AAAA,gBAAA,IAGH,gBAAAb,EAAC,OAAA,EAAI,WAAWI,EAAO,MAAM,gBAAcI,IAAW,SAAS,QAC5D,UAAAK,EAAA,CACH;AAAA,gBAED,CAACH,KACA,gBAAAV;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,WAAWG,EAAKC,EAAO,WAAWvC,IAAIU,KAAU6B,EAAO,IAAI;AAAA,oBAC3D,eAAY;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAIf9C,KAAYO,MAAMU,KAAU8B,EAAK,WAAW,QAC3C,gBAAAL,EAAC,OAAA,EAAI,WAAWI,EAAO,aAAc,UAAAC,EAAK,QAAA,CAAQ;AAAA,cAAA;AAAA,YAAA;AAAA,YA7B/CxC;AAAA,UAAA;AAAA,QAiCX,CAAC,EAAA,CACH;AAAA,QAEC,CAACP,KAAYgC,KAAiB,0BAAS,OAAA,EAAI,WAAWc,EAAO,OAAQ,UAAAd,EAAA,CAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG1F,CAAC;"}
@@ -1,2 +1,2 @@
1
- "use strict";const s=require("react/jsx-runtime"),o=require("react"),j=require("clsx"),X=require("./names-C2Yj1p3u.cjs"),A=require("./Icon-CXTl_QAP.cjs"),Y=require("./ConfigProvider-h1WoGC3R.cjs"),Z="_root_1xfvk_2",H="_list_1xfvk_5",ee="_horizontal_1xfvk_11",ne="_vertical_1xfvk_24",te="_sm_1xfvk_29",se="_md_1xfvk_34",re="_lg_1xfvk_39",ce="_step_1xfvk_47",oe="_disabled_1xfvk_64",le="_main_1xfvk_69",ie="_indicator_1xfvk_99",ae="_number_1xfvk_125",de="_completed_1xfvk_130",ue="_active_1xfvk_136",fe="_error_1xfvk_144",_e="_text_1xfvk_151",me="_label_1xfvk_167",ve="_description_1xfvk_181",xe="_optional_1xfvk_186",he="_connector_1xfvk_193",be="_done_1xfvk_198",we="_panel_1xfvk_224",pe="_stepContent_1xfvk_228",t={root:Z,list:H,horizontal:ee,vertical:ne,sm:te,md:se,lg:re,step:ce,disabled:oe,main:le,indicator:ie,number:ae,completed:de,active:ue,error:fe,text:_e,label:me,description:ve,optional:xe,connector:he,done:be,panel:we,stepContent:pe},ke=new Set(X.ICON_NAMES),Ne=o.forwardRef(function({steps:a,activeStep:f,defaultStep:g,onStepChange:u,queryKey:y,pushHistory:R=!1,orientation:_="horizontal",size:b="md",color:I="primary",onStepClick:m,"aria-label":M,className:B,style:K},O){var P;const E=_==="vertical",T=m!=null,U=Y.useStepQueryKey(),l=y===!0?U:y||void 0,v=o.useCallback(e=>e!=null&&Number.isInteger(e)&&e>=0&&e<a.length&&!a[e].disabled,[a]),w=o.useCallback(()=>{if(!l||typeof window>"u")return null;const e=new URLSearchParams(window.location.search).get(l);return e!=null&&/^\d+$/.test(e)?Number(e)-1:null},[l]),W=Math.max(a.findIndex(e=>!e.disabled),0),[F,L]=o.useState(()=>{const e=w();return v(e)?e:v(g)?g:W}),q=f!==void 0,r=q?f:F,p=o.useRef(r);p.current=r;const x=o.useRef(u);x.current=u;const k=o.useRef(!1),z=o.useCallback((e,n)=>{if(!l||typeof window>"u")return;const c=new URLSearchParams(window.location.search),i=String(e+1);if(c.get(l)===i)return;c.set(l,i);const d=`${window.location.pathname}?${c.toString()}${window.location.hash}`;window.history[n?"pushState":"replaceState"](window.history.state,"",d)},[l]),D=e=>{e!==p.current&&(k.current=!0,q||L(e),u==null||u(e))};o.useEffect(()=>{if(!l||typeof window>"u"||!Number.isInteger(r)||r<0||r>=a.length)return;const e=k.current&&R;k.current=!1,z(r,e)},[l,r,R,z,a.length]),o.useEffect(()=>{if(!l||typeof window>"u")return;const e=()=>{var c;const n=w();v(n)&&n!==p.current&&(f===void 0&&L(n),(c=x.current)==null||c.call(x,n))};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[l,w,v,f]);const $=(P=a[r])==null?void 0:P.content,C=o.useRef(null);o.useEffect(()=>{if(_==="vertical")return;const e=C.current,n=e==null?void 0:e.children[r];if(!e||!n)return;const c=e.getBoundingClientRect(),i=n.getBoundingClientRect(),d=i.left-c.left+e.scrollLeft,h=d+i.width;d<e.scrollLeft?e.scrollLeft=d:h>e.scrollLeft+e.clientWidth&&(e.scrollLeft=h-e.clientWidth)},[r,_]);const G=e=>typeof e=="string"&&ke.has(e)?s.jsx(A.Icon,{name:e,size:b}):e;return s.jsxs("div",{ref:O,className:j.clsx(t.root,t[_],t[b],B),style:{"--tz-btn-rgb":`var(--tz-color-${I}-rgb)`,"--tz-btn-on":`var(--tz-color-${I}-contrast, #fff)`,...K},children:[s.jsx("ol",{ref:C,"aria-label":M,className:t.list,children:a.map((e,n)=>{const c=!!e.error,i=!c&&(e.completed||n<r),d=!c&&!i&&n===r,h=c?"error":i?"completed":d?"active":"upcoming",J=n===a.length-1,N=G(e.icon),S=N??(i?s.jsx(A.Icon,{name:"Check",size:b}):s.jsx("span",{className:t.number,children:n+1})),V=e.label!=null||e.description!=null||e.optional!=null,Q=s.jsxs(s.Fragment,{children:[s.jsx("span",{className:t.indicator,"aria-hidden":N==null&&!i?void 0:!0,children:S}),V&&s.jsxs("span",{className:t.text,children:[e.label!=null&&s.jsx("span",{className:t.label,children:e.label}),e.description!=null&&s.jsx("span",{className:t.description,children:e.description}),e.optional!=null&&s.jsx("span",{className:t.optional,children:e.optional})]})]});return s.jsxs("li",{className:j.clsx(t.step,t[h],e.disabled&&t.disabled),children:[T?s.jsx("button",{type:"button",className:t.main,disabled:e.disabled,"aria-current":d?"step":void 0,onClick:()=>{m==null||m(n),D(n)},children:Q}):s.jsx("div",{className:t.main,"aria-current":d?"step":void 0,children:Q}),!J&&s.jsx("span",{className:j.clsx(t.connector,n<r&&t.done),"aria-hidden":"true"}),E&&n===r&&e.content!=null&&s.jsx("div",{className:t.stepContent,children:e.content})]},n)})}),!E&&$!=null&&s.jsx("div",{className:t.panel,children:$})]})});exports.Stepper=Ne;
2
- //# sourceMappingURL=Stepper-Db_ALAc4.cjs.map
1
+ "use strict";const s=require("react/jsx-runtime"),o=require("react"),j=require("clsx"),X=require("./names-BJnFU_5m.cjs"),A=require("./Icon-BVULqOJD.cjs"),Y=require("./ConfigProvider-C7DUWHrb.cjs"),Z="_root_1xfvk_2",H="_list_1xfvk_5",ee="_horizontal_1xfvk_11",ne="_vertical_1xfvk_24",te="_sm_1xfvk_29",se="_md_1xfvk_34",re="_lg_1xfvk_39",ce="_step_1xfvk_47",oe="_disabled_1xfvk_64",le="_main_1xfvk_69",ie="_indicator_1xfvk_99",ae="_number_1xfvk_125",de="_completed_1xfvk_130",ue="_active_1xfvk_136",fe="_error_1xfvk_144",_e="_text_1xfvk_151",me="_label_1xfvk_167",ve="_description_1xfvk_181",xe="_optional_1xfvk_186",he="_connector_1xfvk_193",be="_done_1xfvk_198",we="_panel_1xfvk_224",pe="_stepContent_1xfvk_228",t={root:Z,list:H,horizontal:ee,vertical:ne,sm:te,md:se,lg:re,step:ce,disabled:oe,main:le,indicator:ie,number:ae,completed:de,active:ue,error:fe,text:_e,label:me,description:ve,optional:xe,connector:he,done:be,panel:we,stepContent:pe},ke=new Set(X.ICON_NAMES),Ne=o.forwardRef(function({steps:a,activeStep:f,defaultStep:g,onStepChange:u,queryKey:y,pushHistory:R=!1,orientation:_="horizontal",size:b="md",color:I="primary",onStepClick:m,"aria-label":M,className:B,style:K},O){var P;const E=_==="vertical",T=m!=null,U=Y.useStepQueryKey(),l=y===!0?U:y||void 0,v=o.useCallback(e=>e!=null&&Number.isInteger(e)&&e>=0&&e<a.length&&!a[e].disabled,[a]),w=o.useCallback(()=>{if(!l||typeof window>"u")return null;const e=new URLSearchParams(window.location.search).get(l);return e!=null&&/^\d+$/.test(e)?Number(e)-1:null},[l]),W=Math.max(a.findIndex(e=>!e.disabled),0),[F,L]=o.useState(()=>{const e=w();return v(e)?e:v(g)?g:W}),q=f!==void 0,r=q?f:F,p=o.useRef(r);p.current=r;const x=o.useRef(u);x.current=u;const k=o.useRef(!1),z=o.useCallback((e,n)=>{if(!l||typeof window>"u")return;const c=new URLSearchParams(window.location.search),i=String(e+1);if(c.get(l)===i)return;c.set(l,i);const d=`${window.location.pathname}?${c.toString()}${window.location.hash}`;window.history[n?"pushState":"replaceState"](window.history.state,"",d)},[l]),D=e=>{e!==p.current&&(k.current=!0,q||L(e),u==null||u(e))};o.useEffect(()=>{if(!l||typeof window>"u"||!Number.isInteger(r)||r<0||r>=a.length)return;const e=k.current&&R;k.current=!1,z(r,e)},[l,r,R,z,a.length]),o.useEffect(()=>{if(!l||typeof window>"u")return;const e=()=>{var c;const n=w();v(n)&&n!==p.current&&(f===void 0&&L(n),(c=x.current)==null||c.call(x,n))};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[l,w,v,f]);const $=(P=a[r])==null?void 0:P.content,C=o.useRef(null);o.useEffect(()=>{if(_==="vertical")return;const e=C.current,n=e==null?void 0:e.children[r];if(!e||!n)return;const c=e.getBoundingClientRect(),i=n.getBoundingClientRect(),d=i.left-c.left+e.scrollLeft,h=d+i.width;d<e.scrollLeft?e.scrollLeft=d:h>e.scrollLeft+e.clientWidth&&(e.scrollLeft=h-e.clientWidth)},[r,_]);const G=e=>typeof e=="string"&&ke.has(e)?s.jsx(A.Icon,{name:e,size:b}):e;return s.jsxs("div",{ref:O,className:j.clsx(t.root,t[_],t[b],B),style:{"--tz-btn-rgb":`var(--tz-color-${I}-rgb)`,"--tz-btn-on":`var(--tz-color-${I}-contrast, #fff)`,...K},children:[s.jsx("ol",{ref:C,"aria-label":M,className:t.list,children:a.map((e,n)=>{const c=!!e.error,i=!c&&(e.completed||n<r),d=!c&&!i&&n===r,h=c?"error":i?"completed":d?"active":"upcoming",J=n===a.length-1,N=G(e.icon),S=N??(i?s.jsx(A.Icon,{name:"Check",size:b}):s.jsx("span",{className:t.number,children:n+1})),V=e.label!=null||e.description!=null||e.optional!=null,Q=s.jsxs(s.Fragment,{children:[s.jsx("span",{className:t.indicator,"aria-hidden":N==null&&!i?void 0:!0,children:S}),V&&s.jsxs("span",{className:t.text,children:[e.label!=null&&s.jsx("span",{className:t.label,children:e.label}),e.description!=null&&s.jsx("span",{className:t.description,children:e.description}),e.optional!=null&&s.jsx("span",{className:t.optional,children:e.optional})]})]});return s.jsxs("li",{className:j.clsx(t.step,t[h],e.disabled&&t.disabled),children:[T?s.jsx("button",{type:"button",className:t.main,disabled:e.disabled,"aria-current":d?"step":void 0,onClick:()=>{m==null||m(n),D(n)},children:Q}):s.jsx("div",{className:t.main,"aria-current":d?"step":void 0,children:Q}),!J&&s.jsx("span",{className:j.clsx(t.connector,n<r&&t.done),"aria-hidden":"true"}),E&&n===r&&e.content!=null&&s.jsx("div",{className:t.stepContent,children:e.content})]},n)})}),!E&&$!=null&&s.jsx("div",{className:t.panel,children:$})]})});exports.Stepper=Ne;
2
+ //# sourceMappingURL=Stepper-CVY8NJEI.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Stepper-Db_ALAc4.cjs","sources":["../src/components/Stepper/Stepper.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useStepQueryKey, type ThemeColor } from '../../theme'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport styles from './Stepper.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type StepperOrientation = 'horizontal' | 'vertical'\nexport type StepperSize = 'sm' | 'md' | 'lg'\n\nexport interface StepItem {\n /** Step label. */\n label?: ReactNode\n /** Muted secondary line under the label. */\n description?: ReactNode\n /** Muted caption under the label (e.g. `\"Optional\"`). */\n optional?: ReactNode\n /** Override the step's number indicator with an icon — a known `IconName` or any node. */\n icon?: IconName | ReactNode\n /** Force the **completed** look regardless of the active step (e.g. an already-saved step). */\n completed?: boolean\n /** Marks the step **invalid** — a red indicator + label (e.g. its form section failed validation). */\n error?: boolean\n /** Disables the step — dimmed, (when clickable) not selectable, and skipped by the URL restore. */\n disabled?: boolean\n /**\n * Panel content rendered while this step is active — **below the strip** in horizontal mode, and\n * **inline under the step** (indented beside the rail) in vertical mode. Optional.\n */\n content?: ReactNode\n}\n\nexport interface StepperProps {\n /** The steps, in order. */\n steps: StepItem[]\n /**\n * Controlled current step index (**0-based**). Steps before it read **completed**, the one at it is\n * **active**, and those after it are **upcoming**. Omit for uncontrolled (see `defaultStep`).\n */\n activeStep?: number\n /**\n * Initial step index (uncontrolled). Falls back to the URL query (when URL sync is active and the\n * param is present) and otherwise the first enabled step.\n */\n defaultStep?: number\n /**\n * Fires with the next step index whenever the stepper itself changes the step — a clicked step head,\n * or a Back/Forward `popstate` restore. In controlled mode apply it to your `activeStep` state.\n */\n onStepChange?: (index: number) => void\n /**\n * **Opt-in** URL sync — **off by default** (the URL is never touched when omitted). Pass the bare\n * prop (**`queryKey`** / `true`) to sync the active step under the configured `keys.stepQueryKey`\n * (else `'step'`), or a **string** for a custom param name. The URL value is **1-based**\n * (`?step=2` = index 1) and a page refresh restores it. Two synced steppers on one page need\n * distinct keys.\n */\n queryKey?: boolean | string\n /**\n * Push a history entry on each step change, so the browser **Back** button returns to the previous\n * step. Defaults to `false` — step changes **replace** the URL, so Back leaves the page instead of\n * stepping back through the wizard (and `popstate` still restores a step when one is in the query).\n */\n pushHistory?: boolean\n /**\n * Layout direction. `horizontal` (default) centers each label **under** its circle and **scrolls\n * sideways** when the steps don't fit (so it fits a phone as-is); `vertical` stacks the steps along\n * a rail connector.\n */\n orientation?: StepperOrientation\n /** Preset size. Defaults to `'md'`. */\n size?: StepperSize\n /** Theme palette token tinting the active / completed steps. Defaults to `'primary'`. */\n color?: ThemeColor\n /**\n * Makes steps **clickable** — each step head becomes a `<button>` that fires this with the step index\n * (a `disabled` step never fires); an uncontrolled stepper also selects the clicked step itself. Omit\n * for a display-only progress indicator.\n */\n onStepClick?: (index: number) => void\n /** Accessible label for the stepper list. */\n 'aria-label'?: string\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A step progress indicator. Data-driven via `steps` (each: `label`, `description`, `optional`, `icon`,\n * `completed`, `error`, `disabled`, `content`) — controlled (`activeStep`, 0-based) or uncontrolled\n * (`defaultStep`). **Opt-in URL sync:** pass **`queryKey`** (bare/`true` = the configured\n * `keys.stepQueryKey`, else `'step'`; or a custom string) and the active step syncs to that query param\n * (**1-based** — `?step=2`) so a refresh restores it; with no `queryKey` the URL is never touched.\n * Synced step changes **replace** the URL (Back doesn't walk the wizard); pass **`pushHistory`** to\n * step back with Back.\n * Horizontal (labels centered under the circles) or `vertical` (a rail); when the horizontal steps\n * don't fit, the strip **scrolls sideways** (scrollbar hidden, the active step kept in view) — so it\n * fits a phone as-is. The active step's **`content`** renders below the strip (horizontal) or inline\n * under the step (vertical). Pass **`onStepClick`** to make the steps navigable. Tinted by `color` via\n * the shared `--tz-btn-rgb` pattern; the list is an `<ol>` with `aria-current=\"step\"` on the active step.\n */\nexport const Stepper = forwardRef<HTMLDivElement, StepperProps>(function Stepper(\n {\n steps,\n activeStep,\n defaultStep,\n onStepChange,\n queryKey,\n pushHistory = false,\n orientation = 'horizontal',\n size = 'md',\n color = 'primary',\n onStepClick,\n 'aria-label': ariaLabel,\n className,\n style,\n },\n ref,\n) {\n const vertical = orientation === 'vertical'\n const clickable = onStepClick != null\n\n // resolve the URL-sync key — OPT-IN: omitted/false = no sync (URL untouched); the bare/`true` form\n // uses the configured default (`keys.stepQueryKey`, else 'step'); a string is a custom param name\n const stepQueryKey = useStepQueryKey()\n const syncKey = queryKey === true ? stepQueryKey : queryKey || undefined\n\n const isSelectable = useCallback(\n (i: number | null | undefined): i is number =>\n i != null && Number.isInteger(i) && i >= 0 && i < steps.length && !steps[i].disabled,\n [steps],\n )\n\n // the URL carries the step 1-based (`?step=2` = index 1) — human-friendly, like Table's page param\n const readQuery = useCallback((): number | null => {\n if (!syncKey || typeof window === 'undefined') return null\n const raw = new URLSearchParams(window.location.search).get(syncKey)\n return raw != null && /^\\d+$/.test(raw) ? Number(raw) - 1 : null\n }, [syncKey])\n\n const firstEnabled = Math.max(\n steps.findIndex((s) => !s.disabled),\n 0,\n )\n\n const [internal, setInternal] = useState<number>(() => {\n const q = readQuery()\n if (isSelectable(q)) return q\n return isSelectable(defaultStep) ? defaultStep : firstEnabled\n })\n const isControlled = activeStep !== undefined\n // controlled mode renders the given index verbatim (even past the last step — the \"all completed\"\n // pattern); only the URL/popstate restores are gated by `isSelectable`\n const active = isControlled ? activeStep : internal\n\n // keep the latest active / onStepChange / push-intent for the stable effects + popstate listener\n const activeRef = useRef(active)\n activeRef.current = active\n const onStepChangeRef = useRef(onStepChange)\n onStepChangeRef.current = onStepChange\n const pushIntent = useRef(false)\n\n const writeQuery = useCallback(\n (next: number, push: boolean) => {\n if (!syncKey || typeof window === 'undefined') return\n const params = new URLSearchParams(window.location.search)\n const value = String(next + 1)\n if (params.get(syncKey) === value) return\n params.set(syncKey, value)\n const url = `${window.location.pathname}?${params.toString()}${window.location.hash}`\n window.history[push ? 'pushState' : 'replaceState'](window.history.state, '', url)\n },\n [syncKey],\n )\n\n const select = (next: number) => {\n if (next === activeRef.current) return\n pushIntent.current = true\n if (!isControlled) setInternal(next)\n onStepChange?.(next)\n }\n\n // mirror the active step into the URL whenever it changes (and on mount = canonicalize). A\n // user-driven change `push`es when `pushHistory`; programmatic / popstate changes just `replace`.\n useEffect(() => {\n if (!syncKey || typeof window === 'undefined') return\n // an out-of-range active (e.g. `steps.length` = \"all done\") isn't a step — leave the URL alone\n if (!Number.isInteger(active) || active < 0 || active >= steps.length) return\n const push = pushIntent.current && pushHistory\n pushIntent.current = false\n writeQuery(active, push)\n }, [syncKey, active, pushHistory, writeQuery, steps.length])\n\n // Back/Forward → restore the step from the query\n useEffect(() => {\n if (!syncKey || typeof window === 'undefined') return\n const onPopState = () => {\n const q = readQuery()\n if (isSelectable(q) && q !== activeRef.current) {\n if (activeStep === undefined) setInternal(q)\n onStepChangeRef.current?.(q)\n }\n }\n window.addEventListener('popstate', onPopState)\n return () => window.removeEventListener('popstate', onPopState)\n }, [syncKey, readQuery, isSelectable, activeStep])\n\n const activeContent = steps[active]?.content\n\n // when the horizontal strip overflows (scrolls sideways), keep the active step in view — by moving\n // the strip's own scrollLeft only. (scrollIntoView would also scroll every scrollable ancestor —\n // i.e. the page itself — yanking the viewport down to the stepper on mount.)\n const listRef = useRef<HTMLOListElement | null>(null)\n useEffect(() => {\n if (orientation === 'vertical') return // the vertical rail never scrolls sideways\n const list = listRef.current\n const el = list?.children[active] as HTMLElement | undefined\n if (!list || !el) return\n const listRect = list.getBoundingClientRect()\n const elRect = el.getBoundingClientRect()\n const left = elRect.left - listRect.left + list.scrollLeft\n const right = left + elRect.width\n if (left < list.scrollLeft) list.scrollLeft = left\n else if (right > list.scrollLeft + list.clientWidth) list.scrollLeft = right - list.clientWidth\n }, [active, orientation])\n\n const renderIcon = (icon: StepItem['icon']) =>\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} size={size} />\n ) : (\n icon\n )\n\n return (\n <div\n ref={ref}\n className={clsx(styles.root, styles[orientation], styles[size], className)}\n style={\n {\n '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`,\n '--tz-btn-on': `var(--tz-color-${color}-contrast, #fff)`,\n ...style,\n } as CSSProperties\n }\n >\n <ol ref={listRef} aria-label={ariaLabel} className={styles.list}>\n {steps.map((step, i) => {\n const isError = !!step.error\n const isCompleted = !isError && (step.completed || i < active)\n const isActive = !isError && !isCompleted && i === active\n const state = isError\n ? 'error'\n : isCompleted\n ? 'completed'\n : isActive\n ? 'active'\n : 'upcoming'\n const isLast = i === steps.length - 1\n\n const icon = renderIcon(step.icon)\n const indicator =\n icon != null ? (\n icon\n ) : isCompleted ? (\n <Icon name=\"Check\" size={size} />\n ) : (\n <span className={styles.number}>{i + 1}</span>\n )\n\n const hasText = step.label != null || step.description != null || step.optional != null\n const head = (\n <>\n <span\n className={styles.indicator}\n aria-hidden={icon == null && !isCompleted ? undefined : true}\n >\n {indicator}\n </span>\n {hasText && (\n <span className={styles.text}>\n {step.label != null && <span className={styles.label}>{step.label}</span>}\n {step.description != null && (\n <span className={styles.description}>{step.description}</span>\n )}\n {step.optional != null && (\n <span className={styles.optional}>{step.optional}</span>\n )}\n </span>\n )}\n </>\n )\n\n return (\n <li\n key={i}\n className={clsx(styles.step, styles[state], step.disabled && styles.disabled)}\n >\n {clickable ? (\n <button\n type=\"button\"\n className={styles.main}\n disabled={step.disabled}\n aria-current={isActive ? 'step' : undefined}\n onClick={() => {\n onStepClick?.(i)\n select(i)\n }}\n >\n {head}\n </button>\n ) : (\n <div className={styles.main} aria-current={isActive ? 'step' : undefined}>\n {head}\n </div>\n )}\n {!isLast && (\n <span\n className={clsx(styles.connector, i < active && styles.done)}\n aria-hidden=\"true\"\n />\n )}\n {/* vertical: the active step's content sits inline, indented beside the rail */}\n {vertical && i === active && step.content != null && (\n <div className={styles.stepContent}>{step.content}</div>\n )}\n </li>\n )\n })}\n </ol>\n {/* horizontal: the active step's content renders as a panel below the strip */}\n {!vertical && activeContent != null && <div className={styles.panel}>{activeContent}</div>}\n </div>\n )\n})\n"],"names":["ICON_NAME_SET","ICON_NAMES","Stepper","forwardRef","steps","activeStep","defaultStep","onStepChange","queryKey","pushHistory","orientation","size","color","onStepClick","ariaLabel","className","style","ref","vertical","clickable","stepQueryKey","useStepQueryKey","syncKey","isSelectable","useCallback","i","readQuery","raw","firstEnabled","s","internal","setInternal","useState","q","isControlled","active","activeRef","useRef","onStepChangeRef","pushIntent","writeQuery","next","push","params","value","url","select","useEffect","onPopState","_a","activeContent","listRef","list","el","listRect","elRect","left","right","renderIcon","icon","jsx","Icon","jsxs","clsx","styles","step","isError","isCompleted","isActive","state","isLast","indicator","hasText","head","Fragment"],"mappings":"m7BAeMA,GAAgB,IAAI,IAAYC,YAAU,EA+FnCC,GAAUC,EAAAA,WAAyC,SAC9D,CACE,MAAAC,EACA,WAAAC,EACA,YAAAC,EACA,aAAAC,EACA,SAAAC,EACA,YAAAC,EAAc,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AC,OAAA,CACC,UAAWG,EAAAA,KAAKC,EAAO,UAAWvC,EAAIU,GAAU6B,EAAO,IAAI,EAC3D,cAAY,MAAA,CAAA,EAIf9C,GAAYO,IAAMU,GAAU8B,EAAK,SAAW,MAC3CL,EAAAA,IAAC,MAAA,CAAI,UAAWI,EAAO,YAAc,SAAAC,EAAK,OAAA,CAAQ,CAAA,CAAA,EA7B/CxC,CAAA,CAiCX,CAAC,CAAA,CACH,EAEC,CAACP,GAAYgC,GAAiB,YAAS,MAAA,CAAI,UAAWc,EAAO,MAAQ,SAAAd,CAAA,CAAc,CAAA,CAAA,CAAA,CAG1F,CAAC"}
1
+ {"version":3,"file":"Stepper-CVY8NJEI.cjs","sources":["../src/components/Stepper/Stepper.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useStepQueryKey, type ThemeColor } from '../../theme'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport styles from './Stepper.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type StepperOrientation = 'horizontal' | 'vertical'\nexport type StepperSize = 'sm' | 'md' | 'lg'\n\nexport interface StepItem {\n /** Step label. */\n label?: ReactNode\n /** Muted secondary line under the label. */\n description?: ReactNode\n /** Muted caption under the label (e.g. `\"Optional\"`). */\n optional?: ReactNode\n /** Override the step's number indicator with an icon — a known `IconName` or any node. */\n icon?: IconName | ReactNode\n /** Force the **completed** look regardless of the active step (e.g. an already-saved step). */\n completed?: boolean\n /** Marks the step **invalid** — a red indicator + label (e.g. its form section failed validation). */\n error?: boolean\n /** Disables the step — dimmed, (when clickable) not selectable, and skipped by the URL restore. */\n disabled?: boolean\n /**\n * Panel content rendered while this step is active — **below the strip** in horizontal mode, and\n * **inline under the step** (indented beside the rail) in vertical mode. Optional.\n */\n content?: ReactNode\n}\n\nexport interface StepperProps {\n /** The steps, in order. */\n steps: StepItem[]\n /**\n * Controlled current step index (**0-based**). Steps before it read **completed**, the one at it is\n * **active**, and those after it are **upcoming**. Omit for uncontrolled (see `defaultStep`).\n */\n activeStep?: number\n /**\n * Initial step index (uncontrolled). Falls back to the URL query (when URL sync is active and the\n * param is present) and otherwise the first enabled step.\n */\n defaultStep?: number\n /**\n * Fires with the next step index whenever the stepper itself changes the step — a clicked step head,\n * or a Back/Forward `popstate` restore. In controlled mode apply it to your `activeStep` state.\n */\n onStepChange?: (index: number) => void\n /**\n * **Opt-in** URL sync — **off by default** (the URL is never touched when omitted). Pass the bare\n * prop (**`queryKey`** / `true`) to sync the active step under the configured `keys.stepQueryKey`\n * (else `'step'`), or a **string** for a custom param name. The URL value is **1-based**\n * (`?step=2` = index 1) and a page refresh restores it. Two synced steppers on one page need\n * distinct keys.\n */\n queryKey?: boolean | string\n /**\n * Push a history entry on each step change, so the browser **Back** button returns to the previous\n * step. Defaults to `false` — step changes **replace** the URL, so Back leaves the page instead of\n * stepping back through the wizard (and `popstate` still restores a step when one is in the query).\n */\n pushHistory?: boolean\n /**\n * Layout direction. `horizontal` (default) centers each label **under** its circle and **scrolls\n * sideways** when the steps don't fit (so it fits a phone as-is); `vertical` stacks the steps along\n * a rail connector.\n */\n orientation?: StepperOrientation\n /** Preset size. Defaults to `'md'`. */\n size?: StepperSize\n /** Theme palette token tinting the active / completed steps. Defaults to `'primary'`. */\n color?: ThemeColor\n /**\n * Makes steps **clickable** — each step head becomes a `<button>` that fires this with the step index\n * (a `disabled` step never fires); an uncontrolled stepper also selects the clicked step itself. Omit\n * for a display-only progress indicator.\n */\n onStepClick?: (index: number) => void\n /** Accessible label for the stepper list. */\n 'aria-label'?: string\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A step progress indicator. Data-driven via `steps` (each: `label`, `description`, `optional`, `icon`,\n * `completed`, `error`, `disabled`, `content`) — controlled (`activeStep`, 0-based) or uncontrolled\n * (`defaultStep`). **Opt-in URL sync:** pass **`queryKey`** (bare/`true` = the configured\n * `keys.stepQueryKey`, else `'step'`; or a custom string) and the active step syncs to that query param\n * (**1-based** — `?step=2`) so a refresh restores it; with no `queryKey` the URL is never touched.\n * Synced step changes **replace** the URL (Back doesn't walk the wizard); pass **`pushHistory`** to\n * step back with Back.\n * Horizontal (labels centered under the circles) or `vertical` (a rail); when the horizontal steps\n * don't fit, the strip **scrolls sideways** (scrollbar hidden, the active step kept in view) — so it\n * fits a phone as-is. The active step's **`content`** renders below the strip (horizontal) or inline\n * under the step (vertical). Pass **`onStepClick`** to make the steps navigable. Tinted by `color` via\n * the shared `--tz-btn-rgb` pattern; the list is an `<ol>` with `aria-current=\"step\"` on the active step.\n */\nexport const Stepper = forwardRef<HTMLDivElement, StepperProps>(function Stepper(\n {\n steps,\n activeStep,\n defaultStep,\n onStepChange,\n queryKey,\n pushHistory = false,\n orientation = 'horizontal',\n size = 'md',\n color = 'primary',\n onStepClick,\n 'aria-label': ariaLabel,\n className,\n style,\n },\n ref,\n) {\n const vertical = orientation === 'vertical'\n const clickable = onStepClick != null\n\n // resolve the URL-sync key — OPT-IN: omitted/false = no sync (URL untouched); the bare/`true` form\n // uses the configured default (`keys.stepQueryKey`, else 'step'); a string is a custom param name\n const stepQueryKey = useStepQueryKey()\n const syncKey = queryKey === true ? stepQueryKey : queryKey || undefined\n\n const isSelectable = useCallback(\n (i: number | null | undefined): i is number =>\n i != null && Number.isInteger(i) && i >= 0 && i < steps.length && !steps[i].disabled,\n [steps],\n )\n\n // the URL carries the step 1-based (`?step=2` = index 1) — human-friendly, like Table's page param\n const readQuery = useCallback((): number | null => {\n if (!syncKey || typeof window === 'undefined') return null\n const raw = new URLSearchParams(window.location.search).get(syncKey)\n return raw != null && /^\\d+$/.test(raw) ? Number(raw) - 1 : null\n }, [syncKey])\n\n const firstEnabled = Math.max(\n steps.findIndex((s) => !s.disabled),\n 0,\n )\n\n const [internal, setInternal] = useState<number>(() => {\n const q = readQuery()\n if (isSelectable(q)) return q\n return isSelectable(defaultStep) ? defaultStep : firstEnabled\n })\n const isControlled = activeStep !== undefined\n // controlled mode renders the given index verbatim (even past the last step — the \"all completed\"\n // pattern); only the URL/popstate restores are gated by `isSelectable`\n const active = isControlled ? activeStep : internal\n\n // keep the latest active / onStepChange / push-intent for the stable effects + popstate listener\n const activeRef = useRef(active)\n activeRef.current = active\n const onStepChangeRef = useRef(onStepChange)\n onStepChangeRef.current = onStepChange\n const pushIntent = useRef(false)\n\n const writeQuery = useCallback(\n (next: number, push: boolean) => {\n if (!syncKey || typeof window === 'undefined') return\n const params = new URLSearchParams(window.location.search)\n const value = String(next + 1)\n if (params.get(syncKey) === value) return\n params.set(syncKey, value)\n const url = `${window.location.pathname}?${params.toString()}${window.location.hash}`\n window.history[push ? 'pushState' : 'replaceState'](window.history.state, '', url)\n },\n [syncKey],\n )\n\n const select = (next: number) => {\n if (next === activeRef.current) return\n pushIntent.current = true\n if (!isControlled) setInternal(next)\n onStepChange?.(next)\n }\n\n // mirror the active step into the URL whenever it changes (and on mount = canonicalize). A\n // user-driven change `push`es when `pushHistory`; programmatic / popstate changes just `replace`.\n useEffect(() => {\n if (!syncKey || typeof window === 'undefined') return\n // an out-of-range active (e.g. `steps.length` = \"all done\") isn't a step — leave the URL alone\n if (!Number.isInteger(active) || active < 0 || active >= steps.length) return\n const push = pushIntent.current && pushHistory\n pushIntent.current = false\n writeQuery(active, push)\n }, [syncKey, active, pushHistory, writeQuery, steps.length])\n\n // Back/Forward → restore the step from the query\n useEffect(() => {\n if (!syncKey || typeof window === 'undefined') return\n const onPopState = () => {\n const q = readQuery()\n if (isSelectable(q) && q !== activeRef.current) {\n if (activeStep === undefined) setInternal(q)\n onStepChangeRef.current?.(q)\n }\n }\n window.addEventListener('popstate', onPopState)\n return () => window.removeEventListener('popstate', onPopState)\n }, [syncKey, readQuery, isSelectable, activeStep])\n\n const activeContent = steps[active]?.content\n\n // when the horizontal strip overflows (scrolls sideways), keep the active step in view — by moving\n // the strip's own scrollLeft only. (scrollIntoView would also scroll every scrollable ancestor —\n // i.e. the page itself — yanking the viewport down to the stepper on mount.)\n const listRef = useRef<HTMLOListElement | null>(null)\n useEffect(() => {\n if (orientation === 'vertical') return // the vertical rail never scrolls sideways\n const list = listRef.current\n const el = list?.children[active] as HTMLElement | undefined\n if (!list || !el) return\n const listRect = list.getBoundingClientRect()\n const elRect = el.getBoundingClientRect()\n const left = elRect.left - listRect.left + list.scrollLeft\n const right = left + elRect.width\n if (left < list.scrollLeft) list.scrollLeft = left\n else if (right > list.scrollLeft + list.clientWidth) list.scrollLeft = right - list.clientWidth\n }, [active, orientation])\n\n const renderIcon = (icon: StepItem['icon']) =>\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} size={size} />\n ) : (\n icon\n )\n\n return (\n <div\n ref={ref}\n className={clsx(styles.root, styles[orientation], styles[size], className)}\n style={\n {\n '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`,\n '--tz-btn-on': `var(--tz-color-${color}-contrast, #fff)`,\n ...style,\n } as CSSProperties\n }\n >\n <ol ref={listRef} aria-label={ariaLabel} className={styles.list}>\n {steps.map((step, i) => {\n const isError = !!step.error\n const isCompleted = !isError && (step.completed || i < active)\n const isActive = !isError && !isCompleted && i === active\n const state = isError\n ? 'error'\n : isCompleted\n ? 'completed'\n : isActive\n ? 'active'\n : 'upcoming'\n const isLast = i === steps.length - 1\n\n const icon = renderIcon(step.icon)\n const indicator =\n icon != null ? (\n icon\n ) : isCompleted ? (\n <Icon name=\"Check\" size={size} />\n ) : (\n <span className={styles.number}>{i + 1}</span>\n )\n\n const hasText = step.label != null || step.description != null || step.optional != null\n const head = (\n <>\n <span\n className={styles.indicator}\n aria-hidden={icon == null && !isCompleted ? undefined : true}\n >\n {indicator}\n </span>\n {hasText && (\n <span className={styles.text}>\n {step.label != null && <span className={styles.label}>{step.label}</span>}\n {step.description != null && (\n <span className={styles.description}>{step.description}</span>\n )}\n {step.optional != null && (\n <span className={styles.optional}>{step.optional}</span>\n )}\n </span>\n )}\n </>\n )\n\n return (\n <li\n key={i}\n className={clsx(styles.step, styles[state], step.disabled && styles.disabled)}\n >\n {clickable ? (\n <button\n type=\"button\"\n className={styles.main}\n disabled={step.disabled}\n aria-current={isActive ? 'step' : undefined}\n onClick={() => {\n onStepClick?.(i)\n select(i)\n }}\n >\n {head}\n </button>\n ) : (\n <div className={styles.main} aria-current={isActive ? 'step' : undefined}>\n {head}\n </div>\n )}\n {!isLast && (\n <span\n className={clsx(styles.connector, i < active && styles.done)}\n aria-hidden=\"true\"\n />\n )}\n {/* vertical: the active step's content sits inline, indented beside the rail */}\n {vertical && i === active && step.content != null && (\n <div className={styles.stepContent}>{step.content}</div>\n )}\n </li>\n )\n })}\n </ol>\n {/* horizontal: the active step's content renders as a panel below the strip */}\n {!vertical && activeContent != null && <div className={styles.panel}>{activeContent}</div>}\n </div>\n )\n})\n"],"names":["ICON_NAME_SET","ICON_NAMES","Stepper","forwardRef","steps","activeStep","defaultStep","onStepChange","queryKey","pushHistory","orientation","size","color","onStepClick","ariaLabel","className","style","ref","vertical","clickable","stepQueryKey","useStepQueryKey","syncKey","isSelectable","useCallback","i","readQuery","raw","firstEnabled","s","internal","setInternal","useState","q","isControlled","active","activeRef","useRef","onStepChangeRef","pushIntent","writeQuery","next","push","params","value","url","select","useEffect","onPopState","_a","activeContent","listRef","list","el","listRect","elRect","left","right","renderIcon","icon","jsx","Icon","jsxs","clsx","styles","step","isError","isCompleted","isActive","state","isLast","indicator","hasText","head","Fragment"],"mappings":"m7BAeMA,GAAgB,IAAI,IAAYC,YAAU,EA+FnCC,GAAUC,EAAAA,WAAyC,SAC9D,CACE,MAAAC,EACA,WAAAC,EACA,YAAAC,EACA,aAAAC,EACA,SAAAC,EACA,YAAAC,EAAc,GACd,YAAAC,EAAc,aACd,KAAAC,EAAO,KACP,MAAAC,EAAQ,UACR,YAAAC,EACA,aAAcC,EACd,UAAAC,EACA,MAAAC,CACF,EACAC,EACA,OACA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MU,GAAU8B,EAAK,SAAW,MAC3CL,EAAAA,IAAC,MAAA,CAAI,UAAWI,EAAO,YAAc,SAAAC,EAAK,OAAA,CAAQ,CAAA,CAAA,EA7B/CxC,CAAA,CAiCX,CAAC,CAAA,CACH,EAEC,CAACP,GAAYgC,GAAiB,YAAS,MAAA,CAAI,UAAWc,EAAO,MAAQ,SAAAd,CAAA,CAAc,CAAA,CAAA,CAAA,CAG1F,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";const t=require("react/jsx-runtime"),u=require("react"),N=require("clsx"),U=require("./formContext-bTWrqdEV.cjs"),G=require("./Icon-CXTl_QAP.cjs"),R=require("./Typography-BFatE1_A.cjs"),i=require("./TextField.module-m-UllwzG.cjs"),J="_swatches_1kbcs_3",M="_sm_1kbcs_13",O="_md_1kbcs_18",Q="_lg_1kbcs_23",W="_swatch_1kbcs_3",m={swatches:J,sm:M,md:O,lg:Q,swatch:W},X=u.forwardRef(function({colors:r,value:p,defaultValue:A=null,onChange:h,size:b="md",labels:w,label:d,error:C,helperText:L,required:D=!1,name:c,className:F,"aria-label":P,...B},E){const x=u.useId(),v=`${x}-label`,k=`${x}-helper`,o=U.useFormContext(),_=!!(o&&c),l=o&&c?o.field(c):void 0,S=p!==void 0?p:_?o.values[c]??null:void 0,I=S!==void 0,[H,K]=u.useState(A),g=((I?S:H)??"").toLowerCase(),f=C??(l==null?void 0:l.error)??!1,y=L??(l==null?void 0:l.helperText),j=e=>{I||K(e),_&&o.setValue(c,e),h==null||h(e)},q=u.useRef([]),T=r.findIndex(e=>e.toLowerCase()===g),V=T>=0?T:0,$=(e,a)=>{var n;let s=a;switch(e.key){case"ArrowRight":case"ArrowDown":s=(a+1)%r.length;break;case"ArrowLeft":case"ArrowUp":s=(a-1+r.length)%r.length;break;case"Home":s=0;break;case"End":s=r.length-1;break;default:return}e.preventDefault(),j(r[s]),(n=q.current[s])==null||n.focus()};return t.jsxs("div",{ref:E,className:N.clsx(i.fieldStyles.field,i.fieldStyles[b],f&&i.fieldStyles.error,F),...B,children:[d!=null&&t.jsxs("label",{id:v,className:i.fieldStyles.label,children:[t.jsx(R.Typography,{as:"span",variant:"bodySmall",color:"muted",children:d}),D&&t.jsx("span",{className:i.fieldStyles.required,"aria-hidden":"true",children:"*"})]}),t.jsx("div",{role:"radiogroup","aria-labelledby":d!=null?v:void 0,"aria-label":d==null?P:void 0,"aria-invalid":f||void 0,"aria-describedby":y!=null?k:void 0,className:N.clsx(m.swatches,m[b]),...c?{name:c,tabIndex:-1}:{},children:r.map((e,a)=>{const s=e.toLowerCase()===g;return t.jsx("button",{ref:n=>{q.current[a]=n},type:"button",role:"radio","aria-checked":s,"aria-label":(w==null?void 0:w[e])??e,tabIndex:a===V?0:-1,className:m.swatch,style:{"--sw":e},onClick:()=>j(e),onKeyDown:n=>$(n,a),children:s?t.jsx(G.Icon,{name:"TickCircle",style:{width:"var(--sw-icon)",height:"var(--sw-icon)"}}):null},e)})}),y!=null&&t.jsx(R.Typography,{as:"span",id:k,variant:"bodySmall",color:f?"error":"muted",className:i.fieldStyles.helper,children:y})]})});exports.SwatchPicker=X;
2
- //# sourceMappingURL=SwatchPicker-DbAU9-ux.cjs.map
1
+ "use strict";const t=require("react/jsx-runtime"),u=require("react"),N=require("clsx"),U=require("./formContext-bTWrqdEV.cjs"),G=require("./Icon-BVULqOJD.cjs"),R=require("./Typography-BFatE1_A.cjs"),i=require("./TextField.module-m-UllwzG.cjs"),J="_swatches_1kbcs_3",M="_sm_1kbcs_13",O="_md_1kbcs_18",Q="_lg_1kbcs_23",W="_swatch_1kbcs_3",m={swatches:J,sm:M,md:O,lg:Q,swatch:W},X=u.forwardRef(function({colors:r,value:p,defaultValue:A=null,onChange:h,size:b="md",labels:w,label:d,error:C,helperText:L,required:D=!1,name:c,className:F,"aria-label":P,...B},E){const x=u.useId(),v=`${x}-label`,k=`${x}-helper`,o=U.useFormContext(),_=!!(o&&c),l=o&&c?o.field(c):void 0,S=p!==void 0?p:_?o.values[c]??null:void 0,I=S!==void 0,[H,K]=u.useState(A),g=((I?S:H)??"").toLowerCase(),f=C??(l==null?void 0:l.error)??!1,y=L??(l==null?void 0:l.helperText),j=e=>{I||K(e),_&&o.setValue(c,e),h==null||h(e)},q=u.useRef([]),T=r.findIndex(e=>e.toLowerCase()===g),V=T>=0?T:0,$=(e,a)=>{var n;let s=a;switch(e.key){case"ArrowRight":case"ArrowDown":s=(a+1)%r.length;break;case"ArrowLeft":case"ArrowUp":s=(a-1+r.length)%r.length;break;case"Home":s=0;break;case"End":s=r.length-1;break;default:return}e.preventDefault(),j(r[s]),(n=q.current[s])==null||n.focus()};return t.jsxs("div",{ref:E,className:N.clsx(i.fieldStyles.field,i.fieldStyles[b],f&&i.fieldStyles.error,F),...B,children:[d!=null&&t.jsxs("label",{id:v,className:i.fieldStyles.label,children:[t.jsx(R.Typography,{as:"span",variant:"bodySmall",color:"muted",children:d}),D&&t.jsx("span",{className:i.fieldStyles.required,"aria-hidden":"true",children:"*"})]}),t.jsx("div",{role:"radiogroup","aria-labelledby":d!=null?v:void 0,"aria-label":d==null?P:void 0,"aria-invalid":f||void 0,"aria-describedby":y!=null?k:void 0,className:N.clsx(m.swatches,m[b]),...c?{name:c,tabIndex:-1}:{},children:r.map((e,a)=>{const s=e.toLowerCase()===g;return t.jsx("button",{ref:n=>{q.current[a]=n},type:"button",role:"radio","aria-checked":s,"aria-label":(w==null?void 0:w[e])??e,tabIndex:a===V?0:-1,className:m.swatch,style:{"--sw":e},onClick:()=>j(e),onKeyDown:n=>$(n,a),children:s?t.jsx(G.Icon,{name:"TickCircle",style:{width:"var(--sw-icon)",height:"var(--sw-icon)"}}):null},e)})}),y!=null&&t.jsx(R.Typography,{as:"span",id:k,variant:"bodySmall",color:f?"error":"muted",className:i.fieldStyles.helper,children:y})]})});exports.SwatchPicker=X;
2
+ //# sourceMappingURL=SwatchPicker-CCJltwHI.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"SwatchPicker-DbAU9-ux.cjs","sources":["../src/components/SwatchPicker/SwatchPicker.tsx"],"sourcesContent":["import {\n forwardRef,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { Icon } from '../Icon'\nimport { Typography } from '../Typography'\n// shared field chrome (wrapper / label / helper / required / error / sizes)\nimport fieldStyles from '../TextField/TextField.module.css'\nimport styles from './SwatchPicker.module.css'\n\nexport type SwatchPickerSize = 'sm' | 'md' | 'lg'\n\nexport interface SwatchPickerProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue'\n> {\n /** The color values to render as selectable swatches (any CSS color — hex / `rgb()` / …). */\n colors: string[]\n /** The selected color (controlled) — matched case-insensitively against `colors`; `null` = none. */\n value?: string | null\n /** Initial selected color (uncontrolled). */\n defaultValue?: string | null\n /** Fires with the clicked color. */\n onChange?: (color: string) => void\n /**\n * Swatch size — `sm` 30 / `md` 36 / `lg` 42 px, each with its own corner radius and tick size\n * (12/16/20). Defaults to `md`. All three are per-size CSS vars in the module.\n */\n size?: SwatchPickerSize\n /** Per-color accessible labels (falls back to the color value itself). */\n labels?: Record<string, string>\n /** Label rendered above the swatches. */\n label?: ReactNode\n /** Marks the field invalid — reddens the label/asterisk and shows `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the swatches. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Form field name — auto-binds to a surrounding `<Form>` (the form value is the color string). */\n name?: string\n}\n\n/**\n * A grid of selectable color **swatches** (rounded tiles) — pick one from a fixed palette. The selected\n * swatch shows a centered white **`TickCircle`** icon. Unlike `ColorPicker` (a field + full popover\n * picker), this is a lightweight primitive for a **preset** set of colors — e.g. an accent-color chooser.\n * Controlled (`value` + `onChange`) or uncontrolled (`defaultValue`); binds to a surrounding `<Form>` by\n * `name` (the form value is the color string — validate with e.g. `z.string().min(1, 'Pick a color')`),\n * and shares the field family's `label` / `error` + `helperText` / `required` chrome.\n *\n * Swatch fills are arbitrary CSS colors (fed via an inline `--sw` var), not `--tz-*` tokens — a\n * deliberate exception, like `ColorPicker`'s spectrum. a11y: `role=\"radiogroup\"` (labelled by `label`\n * or `aria-label`) with `role=\"radio\"` + `aria-checked` swatches; the group carries `name` for the\n * form's scroll-to-error.\n */\nexport const SwatchPicker = forwardRef<HTMLDivElement, SwatchPickerProps>(function SwatchPicker(\n {\n colors,\n value,\n defaultValue = null,\n onChange,\n size = 'md',\n labels,\n label,\n error,\n helperText,\n required = false,\n name,\n className,\n 'aria-label': ariaLabel,\n ...props\n },\n ref,\n) {\n const id = useId()\n const labelId = `${id}-label`\n const helperId = `${id}-helper`\n\n // Auto-bind to a surrounding <Form> by `name` — the form value is the color 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 | null | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | null | undefined) ?? null)\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<string | null>(defaultValue)\n const selected = isControlled ? externalValue! : internal\n const active = (selected ?? '').toLowerCase()\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const pick = (color: string) => {\n if (!isControlled) setInternal(color)\n if (isFormBound) form!.setValue(name!, color)\n onChange?.(color)\n }\n\n // roving tabindex (ARIA radiogroup): only the selected swatch — or the first, if none — is tabbable;\n // arrows move selection between swatches (wrapping), Home/End jump to the ends\n const swatchRefs = useRef<(HTMLButtonElement | null)[]>([])\n const selectedIndex = colors.findIndex((c) => c.toLowerCase() === active)\n const tabbableIndex = selectedIndex >= 0 ? selectedIndex : 0\n const onSwatchKey = (event: ReactKeyboardEvent<HTMLButtonElement>, index: number) => {\n let target = index\n switch (event.key) {\n case 'ArrowRight':\n case 'ArrowDown':\n target = (index + 1) % colors.length\n break\n case 'ArrowLeft':\n case 'ArrowUp':\n target = (index - 1 + colors.length) % colors.length\n break\n case 'Home':\n target = 0\n break\n case 'End':\n target = colors.length - 1\n break\n default:\n return\n }\n event.preventDefault()\n pick(colors[target])\n swatchRefs.current[target]?.focus()\n }\n\n return (\n <div\n ref={ref}\n className={clsx(\n fieldStyles.field,\n fieldStyles[size],\n resolvedError && fieldStyles.error,\n className,\n )}\n {...props}\n >\n {label != null && (\n <label id={labelId} className={fieldStyles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={fieldStyles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n <div\n role=\"radiogroup\"\n aria-labelledby={label != null ? labelId : undefined}\n aria-label={label == null ? ariaLabel : undefined}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n className={clsx(styles.swatches, styles[size])}\n // name + tabIndex are load-bearing for the form's scroll-to-error\n {...(name ? { name, tabIndex: -1 } : {})}\n >\n {colors.map((color, index) => {\n const isSelected = color.toLowerCase() === active\n return (\n <button\n key={color}\n ref={(el) => {\n swatchRefs.current[index] = el\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={isSelected}\n aria-label={labels?.[color] ?? color}\n tabIndex={index === tabbableIndex ? 0 : -1}\n className={styles.swatch}\n style={{ '--sw': color } as CSSProperties}\n onClick={() => pick(color)}\n onKeyDown={(e) => onSwatchKey(e, index)}\n >\n {isSelected ? (\n <Icon\n name=\"TickCircle\"\n style={{ width: 'var(--sw-icon)', height: 'var(--sw-icon)' }}\n />\n ) : null}\n </button>\n )\n })}\n </div>\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={fieldStyles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["SwatchPicker","forwardRef","colors","value","defaultValue","onChange","size","labels","label","error","helperText","required","name","className","ariaLabel","props","ref","id","useId","labelId","helperId","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","active","resolvedError","resolvedHelperText","pick","color","swatchRefs","useRef","selectedIndex","c","tabbableIndex","onSwatchKey","event","index","target","_a","jsxs","clsx","fieldStyles","jsx","Typography","styles","isSelected","el","e","Icon"],"mappings":"wXAgEaA,EAAeC,EAAAA,WAA8C,SACxE,CACE,OAAAC,EACA,MAAAC,EACA,aAAAC,EAAe,KACf,SAAAC,EACA,KAAAC,EAAO,KACP,OAAAC,EACA,MAAAC,EACA,MAAAC,EACA,WAAAC,EACA,SAAAC,EAAW,GACX,KAAAC,EACA,UAAAC,EACA,aAAcC,EACd,GAAGC,CACL,EACAC,EACA,CACA,MAAMC,EAAKC,EAAAA,MAAA,EACLC,EAAU,GAAGF,CAAE,SACfG,EAAW,GAAGH,CAAE,UAGhBI,EAAOC,EAAAA,eAAA,EACPC,EAAc,GAAQF,GAAQT,GAC9BY,EAAQH,GAAQT,EAAOS,EAAK,MAAMT,CAAI,EAAI,OAE1Ca,EACJtB,IAAU,OACNA,EACAoB,EACIF,EAAM,OAAOT,CAAK,GAAmC,KACvD,OACFc,EAAeD,IAAkB,OACjC,CAACE,EAAUC,CAAW,EAAIC,EAAAA,SAAwBzB,CAAY,EAE9D0B,IADWJ,EAAeD,EAAiBE,IACrB,IAAI,YAAA,EAE1BI,EAAgBtB,IAASe,GAAA,YAAAA,EAAO,QAAS,GACzCQ,EAAqBtB,IAAcc,GAAA,YAAAA,EAAO,YAE1CS,EAAQC,GAAkB,CACzBR,GAAcE,EAAYM,CAAK,EAChCX,GAAaF,EAAM,SAAST,EAAOsB,CAAK,EAC5C7B,GAAA,MAAAA,EAAW6B,EACb,EAIMC,EAAaC,EAAAA,OAAqC,EAAE,EACpDC,EAAgBnC,EAAO,UAAWoC,GAAMA,EAAE,YAAA,IAAkBR,CAAM,EAClES,EAAgBF,GAAiB,EAAIA,EAAgB,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AMS,EAAajB,EAAM,YAAA,IAAkBJ,EAC3C,OACEkB,EAAAA,IAAC,SAAA,CAEC,IAAMI,GAAO,CACXjB,EAAW,QAAQO,CAAK,EAAIU,CAC9B,EACA,KAAK,SACL,KAAK,QACL,eAAcD,EACd,cAAY5C,GAAA,YAAAA,EAAS2B,KAAUA,EAC/B,SAAUQ,IAAUH,EAAgB,EAAI,GACxC,UAAWW,EAAO,OAClB,MAAO,CAAE,OAAQhB,CAAA,EACjB,QAAS,IAAMD,EAAKC,CAAK,EACzB,UAAYmB,GAAMb,EAAYa,EAAGX,CAAK,EAErC,SAAAS,EACCH,EAAAA,IAACM,EAAAA,KAAA,CACC,KAAK,aACL,MAAO,CAAE,MAAO,iBAAkB,OAAQ,gBAAA,CAAiB,CAAA,EAE3D,IAAA,EAnBCpB,CAAA,CAsBX,CAAC,CAAA,CAAA,EAEFF,GAAsB,MACrBgB,EAAAA,IAACC,EAAAA,WAAA,CACC,GAAG,OACH,GAAI7B,EACJ,QAAQ,YACR,MAAOW,EAAgB,QAAU,QACjC,UAAWgB,EAAAA,YAAY,OAEtB,SAAAf,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,CAAC"}
1
+ {"version":3,"file":"SwatchPicker-CCJltwHI.cjs","sources":["../src/components/SwatchPicker/SwatchPicker.tsx"],"sourcesContent":["import {\n forwardRef,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { Icon } from '../Icon'\nimport { Typography } from '../Typography'\n// shared field chrome (wrapper / label / helper / required / error / sizes)\nimport fieldStyles from '../TextField/TextField.module.css'\nimport styles from './SwatchPicker.module.css'\n\nexport type SwatchPickerSize = 'sm' | 'md' | 'lg'\n\nexport interface SwatchPickerProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue'\n> {\n /** The color values to render as selectable swatches (any CSS color — hex / `rgb()` / …). */\n colors: string[]\n /** The selected color (controlled) — matched case-insensitively against `colors`; `null` = none. */\n value?: string | null\n /** Initial selected color (uncontrolled). */\n defaultValue?: string | null\n /** Fires with the clicked color. */\n onChange?: (color: string) => void\n /**\n * Swatch size — `sm` 30 / `md` 36 / `lg` 42 px, each with its own corner radius and tick size\n * (12/16/20). Defaults to `md`. All three are per-size CSS vars in the module.\n */\n size?: SwatchPickerSize\n /** Per-color accessible labels (falls back to the color value itself). */\n labels?: Record<string, string>\n /** Label rendered above the swatches. */\n label?: ReactNode\n /** Marks the field invalid — reddens the label/asterisk and shows `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the swatches. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Form field name — auto-binds to a surrounding `<Form>` (the form value is the color string). */\n name?: string\n}\n\n/**\n * A grid of selectable color **swatches** (rounded tiles) — pick one from a fixed palette. The selected\n * swatch shows a centered white **`TickCircle`** icon. Unlike `ColorPicker` (a field + full popover\n * picker), this is a lightweight primitive for a **preset** set of colors — e.g. an accent-color chooser.\n * Controlled (`value` + `onChange`) or uncontrolled (`defaultValue`); binds to a surrounding `<Form>` by\n * `name` (the form value is the color string — validate with e.g. `z.string().min(1, 'Pick a color')`),\n * and shares the field family's `label` / `error` + `helperText` / `required` chrome.\n *\n * Swatch fills are arbitrary CSS colors (fed via an inline `--sw` var), not `--tz-*` tokens — a\n * deliberate exception, like `ColorPicker`'s spectrum. a11y: `role=\"radiogroup\"` (labelled by `label`\n * or `aria-label`) with `role=\"radio\"` + `aria-checked` swatches; the group carries `name` for the\n * form's scroll-to-error.\n */\nexport const SwatchPicker = forwardRef<HTMLDivElement, SwatchPickerProps>(function SwatchPicker(\n {\n colors,\n value,\n defaultValue = null,\n onChange,\n size = 'md',\n labels,\n label,\n error,\n helperText,\n required = false,\n name,\n className,\n 'aria-label': ariaLabel,\n ...props\n },\n ref,\n) {\n const id = useId()\n const labelId = `${id}-label`\n const helperId = `${id}-helper`\n\n // Auto-bind to a surrounding <Form> by `name` — the form value is the color 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 | null | undefined =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | null | undefined) ?? null)\n : undefined\n const isControlled = externalValue !== undefined\n const [internal, setInternal] = useState<string | null>(defaultValue)\n const selected = isControlled ? externalValue! : internal\n const active = (selected ?? '').toLowerCase()\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const pick = (color: string) => {\n if (!isControlled) setInternal(color)\n if (isFormBound) form!.setValue(name!, color)\n onChange?.(color)\n }\n\n // roving tabindex (ARIA radiogroup): only the selected swatch — or the first, if none — is tabbable;\n // arrows move selection between swatches (wrapping), Home/End jump to the ends\n const swatchRefs = useRef<(HTMLButtonElement | null)[]>([])\n const selectedIndex = colors.findIndex((c) => c.toLowerCase() === active)\n const tabbableIndex = selectedIndex >= 0 ? selectedIndex : 0\n const onSwatchKey = (event: ReactKeyboardEvent<HTMLButtonElement>, index: number) => {\n let target = index\n switch (event.key) {\n case 'ArrowRight':\n case 'ArrowDown':\n target = (index + 1) % colors.length\n break\n case 'ArrowLeft':\n case 'ArrowUp':\n target = (index - 1 + colors.length) % colors.length\n break\n case 'Home':\n target = 0\n break\n case 'End':\n target = colors.length - 1\n break\n default:\n return\n }\n event.preventDefault()\n pick(colors[target])\n swatchRefs.current[target]?.focus()\n }\n\n return (\n <div\n ref={ref}\n className={clsx(\n fieldStyles.field,\n fieldStyles[size],\n resolvedError && fieldStyles.error,\n className,\n )}\n {...props}\n >\n {label != null && (\n <label id={labelId} className={fieldStyles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={fieldStyles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n <div\n role=\"radiogroup\"\n aria-labelledby={label != null ? labelId : undefined}\n aria-label={label == null ? ariaLabel : undefined}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n className={clsx(styles.swatches, styles[size])}\n // name + tabIndex are load-bearing for the form's scroll-to-error\n {...(name ? { name, tabIndex: -1 } : {})}\n >\n {colors.map((color, index) => {\n const isSelected = color.toLowerCase() === active\n return (\n <button\n key={color}\n ref={(el) => {\n swatchRefs.current[index] = el\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={isSelected}\n aria-label={labels?.[color] ?? color}\n tabIndex={index === tabbableIndex ? 0 : -1}\n className={styles.swatch}\n style={{ '--sw': color } as CSSProperties}\n onClick={() => pick(color)}\n onKeyDown={(e) => onSwatchKey(e, index)}\n >\n {isSelected ? (\n <Icon\n name=\"TickCircle\"\n style={{ width: 'var(--sw-icon)', height: 'var(--sw-icon)' }}\n />\n ) : null}\n </button>\n )\n })}\n </div>\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={fieldStyles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["SwatchPicker","forwardRef","colors","value","defaultValue","onChange","size","labels","label","error","helperText","required","name","className","ariaLabel","props","ref","id","useId","labelId","helperId","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","active","resolvedError","resolvedHelperText","pick","color","swatchRefs","useRef","selectedIndex","c","tabbableIndex","onSwatchKey","event","index","target","_a","jsxs","clsx","fieldStyles","jsx","Typography","styles","isSelected","el","e","Icon"],"mappings":"wXAgEaA,EAAeC,EAAAA,WAA8C,SACxE,CACE,OAAAC,EACA,MAAAC,EACA,aAAAC,EAAe,KACf,SAAAC,EACA,KAAAC,EAAO,KACP,OAAAC,EACA,MAAAC,EACA,MAAAC,EACA,WAAAC,EACA,SAAAC,EAAW,GACX,KAAAC,EACA,UAAAC,EACA,aAAcC,EAC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AAQ,gBAAA,CAAiB,CAAA,EAE3D,IAAA,EAnBCpB,CAAA,CAsBX,CAAC,CAAA,CAAA,EAEFF,GAAsB,MACrBgB,EAAAA,IAACC,EAAAA,WAAA,CACC,GAAG,OACH,GAAI7B,EACJ,QAAQ,YACR,MAAOW,EAAgB,QAAU,QACjC,UAAWgB,EAAAA,YAAY,OAEtB,SAAAf,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,CAAC"}
@@ -2,7 +2,7 @@ import { jsxs as A, jsx as o } from "react/jsx-runtime";
2
2
  import { forwardRef as U, useId as G, useState as J, useRef as M } from "react";
3
3
  import { clsx as L } from "clsx";
4
4
  import { u as O } from "./formContext-B7ln1Miy.js";
5
- import { I as Q } from "./Icon-CophpkHo.js";
5
+ import { I as Q } from "./Icon-DaTvzLBu.js";
6
6
  import { T as R } from "./Typography-Cta6Rg4L.js";
7
7
  import { f as n } from "./TextField.module-QePvGeJ3.js";
8
8
  const W = "_swatches_1kbcs_3", X = "_sm_1kbcs_13", Y = "_md_1kbcs_18", Z = "_lg_1kbcs_23", z = "_swatch_1kbcs_3", w = {
@@ -126,4 +126,4 @@ const W = "_swatches_1kbcs_3", X = "_sm_1kbcs_13", Y = "_md_1kbcs_18", Z = "_lg_
126
126
  export {
127
127
  ie as S
128
128
  };
129
- //# sourceMappingURL=SwatchPicker-D30aSrbY.js.map
129
+ //# sourceMappingURL=SwatchPicker-CqyWngFJ.js.map