@techzyapp/ui-library 1.0.23 → 1.0.25

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 (320) hide show
  1. package/dist/{AdminRoot-C7Idu7FQ.cjs → AdminRoot-BkPPRkyQ.cjs} +2 -2
  2. package/dist/{AdminRoot-C7Idu7FQ.cjs.map → AdminRoot-BkPPRkyQ.cjs.map} +1 -1
  3. package/dist/{AdminRoot-aDy6rNqI.js → AdminRoot-CgvtgUpW.js} +4 -4
  4. package/dist/{AdminRoot-aDy6rNqI.js.map → AdminRoot-CgvtgUpW.js.map} +1 -1
  5. package/dist/Alert-DXmzM_rh.js +71 -0
  6. package/dist/{Alert-D6VL2C-E.js.map → Alert-DXmzM_rh.js.map} +1 -1
  7. package/dist/Alert-udX1ybuC.cjs +2 -0
  8. package/dist/{Alert-Cl1zxmX9.cjs.map → Alert-udX1ybuC.cjs.map} +1 -1
  9. package/dist/Blockquote-BWGxIL_V.cjs +2 -0
  10. package/dist/{Blockquote-CxHwOecc.cjs.map → Blockquote-BWGxIL_V.cjs.map} +1 -1
  11. package/dist/Blockquote-Ma-2naET.js +46 -0
  12. package/dist/{Blockquote-CNIuJFHq.js.map → Blockquote-Ma-2naET.js.map} +1 -1
  13. package/dist/{Breadcrumbs-BnFW4LgK.cjs → Breadcrumbs-CsYTiX2h.cjs} +2 -2
  14. package/dist/{Breadcrumbs-BnFW4LgK.cjs.map → Breadcrumbs-CsYTiX2h.cjs.map} +1 -1
  15. package/dist/{Breadcrumbs-CicfjfIu.js → Breadcrumbs-DQHHeLId.js} +3 -3
  16. package/dist/{Breadcrumbs-CicfjfIu.js.map → Breadcrumbs-DQHHeLId.js.map} +1 -1
  17. package/dist/{Button-ZplrHYKw.cjs → Button-CXmDOzPk.cjs} +2 -2
  18. package/dist/{Button-ZplrHYKw.cjs.map → Button-CXmDOzPk.cjs.map} +1 -1
  19. package/dist/{Button-Cfxd7qhd.js → Button-DBs8xnA5.js} +2 -2
  20. package/dist/{Button-Cfxd7qhd.js.map → Button-DBs8xnA5.js.map} +1 -1
  21. package/dist/{Calendar-S9vyp-qv.cjs → Calendar-B2nMXk4C.cjs} +2 -2
  22. package/dist/{Calendar-S9vyp-qv.cjs.map → Calendar-B2nMXk4C.cjs.map} +1 -1
  23. package/dist/{Calendar-DTxCT-ki.js → Calendar-CtteUt82.js} +3 -3
  24. package/dist/{Calendar-DTxCT-ki.js.map → Calendar-CtteUt82.js.map} +1 -1
  25. package/dist/{Card-BeE2ohcn.cjs → Card-DGF22HbS.cjs} +2 -2
  26. package/dist/{Card-BeE2ohcn.cjs.map → Card-DGF22HbS.cjs.map} +1 -1
  27. package/dist/{Card-eXJfA4rU.js → Card-DYKnWt-L.js} +2 -2
  28. package/dist/{Card-eXJfA4rU.js.map → Card-DYKnWt-L.js.map} +1 -1
  29. package/dist/{Chip-BOXXdzap.js → Chip-DdKhcstm.js} +2 -2
  30. package/dist/{Chip-BOXXdzap.js.map → Chip-DdKhcstm.js.map} +1 -1
  31. package/dist/{Chip-B4XERWb_.cjs → Chip-gUH_7nQc.cjs} +2 -2
  32. package/dist/{Chip-B4XERWb_.cjs.map → Chip-gUH_7nQc.cjs.map} +1 -1
  33. package/dist/{CodeBlock-C7_A6CTT.cjs → CodeBlock-C6tQtbHU.cjs} +2 -2
  34. package/dist/{CodeBlock-C7_A6CTT.cjs.map → CodeBlock-C6tQtbHU.cjs.map} +1 -1
  35. package/dist/{CodeBlock-D_PRiWMq.js → CodeBlock-DD_d3-sM.js} +3 -3
  36. package/dist/{CodeBlock-D_PRiWMq.js.map → CodeBlock-DD_d3-sM.js.map} +1 -1
  37. package/dist/{ColorPicker-ClVpWf77.cjs → ColorPicker-DtzFwNWk.cjs} +2 -2
  38. package/dist/{ColorPicker-ClVpWf77.cjs.map → ColorPicker-DtzFwNWk.cjs.map} +1 -1
  39. package/dist/{ColorPicker-DAjs7PmR.js → ColorPicker-Dw6Qk0iy.js} +3 -3
  40. package/dist/{ColorPicker-DAjs7PmR.js.map → ColorPicker-Dw6Qk0iy.js.map} +1 -1
  41. package/dist/{ColorPickerPanel-Dk6bI0Xy.cjs → ColorPickerPanel--wBX-m7J.cjs} +2 -2
  42. package/dist/{ColorPickerPanel-Dk6bI0Xy.cjs.map → ColorPickerPanel--wBX-m7J.cjs.map} +1 -1
  43. package/dist/{ColorPickerPanel-BGzm2had.js → ColorPickerPanel-Dp7bnnVf.js} +2 -2
  44. package/dist/{ColorPickerPanel-BGzm2had.js.map → ColorPickerPanel-Dp7bnnVf.js.map} +1 -1
  45. package/dist/ConfigProvider-Bszl3Wr3.cjs +2 -0
  46. package/dist/ConfigProvider-Bszl3Wr3.cjs.map +1 -0
  47. package/dist/ConfigProvider-DR9YMy9U.js +320 -0
  48. package/dist/ConfigProvider-DR9YMy9U.js.map +1 -0
  49. package/dist/{CopyButton-COF3hIV-.cjs → CopyButton-Ct-8AmmX.cjs} +2 -2
  50. package/dist/{CopyButton-COF3hIV-.cjs.map → CopyButton-Ct-8AmmX.cjs.map} +1 -1
  51. package/dist/{CopyButton-Bv7L4xJf.js → CopyButton-DJ1PSJZU.js} +3 -3
  52. package/dist/{CopyButton-Bv7L4xJf.js.map → CopyButton-DJ1PSJZU.js.map} +1 -1
  53. package/dist/{DatePicker-kA-xn5ET.cjs → DatePicker-BxEydgfu.cjs} +2 -2
  54. package/dist/{DatePicker-kA-xn5ET.cjs.map → DatePicker-BxEydgfu.cjs.map} +1 -1
  55. package/dist/{DatePicker-DZfOvxUR.js → DatePicker-CJioG5M7.js} +4 -4
  56. package/dist/{DatePicker-DZfOvxUR.js.map → DatePicker-CJioG5M7.js.map} +1 -1
  57. package/dist/{DateTimePicker-DEGmn5UX.cjs → DateTimePicker-COEj2Z0F.cjs} +2 -2
  58. package/dist/{DateTimePicker-DEGmn5UX.cjs.map → DateTimePicker-COEj2Z0F.cjs.map} +1 -1
  59. package/dist/{DateTimePicker-BxBXhSN_.js → DateTimePicker-e2zj2bhS.js} +7 -7
  60. package/dist/{DateTimePicker-BxBXhSN_.js.map → DateTimePicker-e2zj2bhS.js.map} +1 -1
  61. package/dist/{EmptyState-Du4vA3bC.js → EmptyState-BTd7aVgu.js} +12 -12
  62. package/dist/{EmptyState-Du4vA3bC.js.map → EmptyState-BTd7aVgu.js.map} +1 -1
  63. package/dist/EmptyState-Bv4XXnD1.cjs +2 -0
  64. package/dist/{EmptyState-DlX-BLLI.cjs.map → EmptyState-Bv4XXnD1.cjs.map} +1 -1
  65. package/dist/{FileCard-zyCpTrJ-.cjs → FileCard-DW5Ur8Aj.cjs} +2 -2
  66. package/dist/{FileCard-zyCpTrJ-.cjs.map → FileCard-DW5Ur8Aj.cjs.map} +1 -1
  67. package/dist/{FileCard-juQ1fWbG.js → FileCard-DY8N9Lzz.js} +3 -3
  68. package/dist/{FileCard-juQ1fWbG.js.map → FileCard-DY8N9Lzz.js.map} +1 -1
  69. package/dist/{FileUploader-DOe3CyJB.cjs → FileUploader-B7VfhcR7.cjs} +2 -2
  70. package/dist/{FileUploader-DOe3CyJB.cjs.map → FileUploader-B7VfhcR7.cjs.map} +1 -1
  71. package/dist/{FileUploader-DL9atihI.js → FileUploader-BYF5FvUc.js} +5 -5
  72. package/dist/{FileUploader-DL9atihI.js.map → FileUploader-BYF5FvUc.js.map} +1 -1
  73. package/dist/{Flag-DFKHYnqk.cjs → Flag-CB4YyPj3.cjs} +2 -2
  74. package/dist/{Flag-DFKHYnqk.cjs.map → Flag-CB4YyPj3.cjs.map} +1 -1
  75. package/dist/{Flag-BxRrjCTB.js → Flag-yA1y5XzR.js} +2 -2
  76. package/dist/{Flag-BxRrjCTB.js.map → Flag-yA1y5XzR.js.map} +1 -1
  77. package/dist/{FullscreenToggle-BNK7RcRq.cjs → FullscreenToggle-0lskYnpx.cjs} +2 -2
  78. package/dist/{FullscreenToggle-BNK7RcRq.cjs.map → FullscreenToggle-0lskYnpx.cjs.map} +1 -1
  79. package/dist/{FullscreenToggle-BMCNsyzb.js → FullscreenToggle-jSLruiKt.js} +3 -3
  80. package/dist/{FullscreenToggle-BMCNsyzb.js.map → FullscreenToggle-jSLruiKt.js.map} +1 -1
  81. package/dist/{IconButton-CfvsE_p3.js → IconButton-BEGWfcVc.js} +2 -2
  82. package/dist/{IconButton-CfvsE_p3.js.map → IconButton-BEGWfcVc.js.map} +1 -1
  83. package/dist/{IconButton-B9eVM18U.cjs → IconButton-BN-bZxEi.cjs} +2 -2
  84. package/dist/{IconButton-B9eVM18U.cjs.map → IconButton-BN-bZxEi.cjs.map} +1 -1
  85. package/dist/{Loader-CxLrhAz9.cjs → Loader-B5YqzEYy.cjs} +2 -2
  86. package/dist/{Loader-CxLrhAz9.cjs.map → Loader-B5YqzEYy.cjs.map} +1 -1
  87. package/dist/Loader-BZIa8hwv.js +29 -0
  88. package/dist/{Loader-DwmyJFwG.js.map → Loader-BZIa8hwv.js.map} +1 -1
  89. package/dist/Modal-0V-REVV-.cjs +2 -0
  90. package/dist/{Modal-DXZdMmJh.cjs.map → Modal-0V-REVV-.cjs.map} +1 -1
  91. package/dist/Modal-B7yoFC3o.js +195 -0
  92. package/dist/{Modal-Cx0JEQ-j.js.map → Modal-B7yoFC3o.js.map} +1 -1
  93. package/dist/{MultiSelect-yGlvweEq.js → MultiSelect-C8xuXaoR.js} +4 -4
  94. package/dist/{MultiSelect-yGlvweEq.js.map → MultiSelect-C8xuXaoR.js.map} +1 -1
  95. package/dist/{MultiSelect-DfhyGxDU.cjs → MultiSelect-gj9Ymeh2.cjs} +2 -2
  96. package/dist/{MultiSelect-DfhyGxDU.cjs.map → MultiSelect-gj9Ymeh2.cjs.map} +1 -1
  97. package/dist/{NumberField-cAjPU1P5.js → NumberField-2yM0mmyj.js} +3 -3
  98. package/dist/{NumberField-cAjPU1P5.js.map → NumberField-2yM0mmyj.js.map} +1 -1
  99. package/dist/{NumberField-B7yPXIw_.cjs → NumberField-CEt95jcC.cjs} +2 -2
  100. package/dist/{NumberField-B7yPXIw_.cjs.map → NumberField-CEt95jcC.cjs.map} +1 -1
  101. package/dist/OtpField-CkliY82J.js +174 -0
  102. package/dist/OtpField-CkliY82J.js.map +1 -0
  103. package/dist/OtpField-on-K0_fM.cjs +2 -0
  104. package/dist/OtpField-on-K0_fM.cjs.map +1 -0
  105. package/dist/{PageLayout-BSHyKoQ4.cjs → PageLayout-DGHu7Vm3.cjs} +2 -2
  106. package/dist/{PageLayout-BSHyKoQ4.cjs.map → PageLayout-DGHu7Vm3.cjs.map} +1 -1
  107. package/dist/{PageLayout-C9Je7kfF.js → PageLayout-DzPh_G6H.js} +2 -2
  108. package/dist/{PageLayout-C9Je7kfF.js.map → PageLayout-DzPh_G6H.js.map} +1 -1
  109. package/dist/{PageNotFound-voB9ylPF.cjs → PageNotFound-B8_eIT8p.cjs} +2 -2
  110. package/dist/{PageNotFound-voB9ylPF.cjs.map → PageNotFound-B8_eIT8p.cjs.map} +1 -1
  111. package/dist/{PageNotFound-CUN2OntP.js → PageNotFound-CCFfPHgA.js} +5 -5
  112. package/dist/{PageNotFound-CUN2OntP.js.map → PageNotFound-CCFfPHgA.js.map} +1 -1
  113. package/dist/{Pagination-BUGaylZa.cjs → Pagination-BdVebW2L.cjs} +2 -2
  114. package/dist/{Pagination-BUGaylZa.cjs.map → Pagination-BdVebW2L.cjs.map} +1 -1
  115. package/dist/{Pagination-BaVHgIWT.js → Pagination-CmskZjcz.js} +2 -2
  116. package/dist/{Pagination-BaVHgIWT.js.map → Pagination-CmskZjcz.js.map} +1 -1
  117. package/dist/{RemoveDialog-BpL2-gnz.js → RemoveDialog-CV75B0aN.js} +4 -4
  118. package/dist/{RemoveDialog-BpL2-gnz.js.map → RemoveDialog-CV75B0aN.js.map} +1 -1
  119. package/dist/{RemoveDialog-DGt_72we.cjs → RemoveDialog-DmOk0ezc.cjs} +2 -2
  120. package/dist/{RemoveDialog-DGt_72we.cjs.map → RemoveDialog-DmOk0ezc.cjs.map} +1 -1
  121. package/dist/{RichTextEditor-C_6pzqYY.js → RichTextEditor-Bm8FFbcR.js} +7 -7
  122. package/dist/{RichTextEditor-C_6pzqYY.js.map → RichTextEditor-Bm8FFbcR.js.map} +1 -1
  123. package/dist/{RichTextEditor-BuoywqBu.cjs → RichTextEditor-uXddgtlk.cjs} +2 -2
  124. package/dist/{RichTextEditor-BuoywqBu.cjs.map → RichTextEditor-uXddgtlk.cjs.map} +1 -1
  125. package/dist/RootLayout-Cf7Rr9Iz.js +515 -0
  126. package/dist/RootLayout-Cf7Rr9Iz.js.map +1 -0
  127. package/dist/RootLayout-kssj9exn.cjs +2 -0
  128. package/dist/RootLayout-kssj9exn.cjs.map +1 -0
  129. package/dist/{Select-CVy5BnKe.cjs → Select-7vEGJCvA.cjs} +2 -2
  130. package/dist/{Select-CVy5BnKe.cjs.map → Select-7vEGJCvA.cjs.map} +1 -1
  131. package/dist/{Select-ChT-6_bM.js → Select-CdX3Ks7y.js} +3 -3
  132. package/dist/{Select-ChT-6_bM.js.map → Select-CdX3Ks7y.js.map} +1 -1
  133. package/dist/{Sidebar-D2MsR33k.cjs → Sidebar-DcKIEfhy.cjs} +2 -2
  134. package/dist/{Sidebar-D2MsR33k.cjs.map → Sidebar-DcKIEfhy.cjs.map} +1 -1
  135. package/dist/{Sidebar-ZA1wxCez.js → Sidebar-YH-DoNG9.js} +3 -3
  136. package/dist/{Sidebar-ZA1wxCez.js.map → Sidebar-YH-DoNG9.js.map} +1 -1
  137. package/dist/{SpeedDial-B9JTNNUU.cjs → SpeedDial-9_Yk8AGx.cjs} +2 -2
  138. package/dist/{SpeedDial-B9JTNNUU.cjs.map → SpeedDial-9_Yk8AGx.cjs.map} +1 -1
  139. package/dist/{SpeedDial-DUYQMDCY.js → SpeedDial-DWNuC6f8.js} +2 -2
  140. package/dist/{SpeedDial-DUYQMDCY.js.map → SpeedDial-DWNuC6f8.js.map} +1 -1
  141. package/dist/{Stepper-BaC934rb.cjs → Stepper-B1z_u650.cjs} +2 -2
  142. package/dist/{Stepper-BaC934rb.cjs.map → Stepper-B1z_u650.cjs.map} +1 -1
  143. package/dist/{Stepper-D89I17pC.js → Stepper-CuqFpamY.js} +2 -2
  144. package/dist/{Stepper-D89I17pC.js.map → Stepper-CuqFpamY.js.map} +1 -1
  145. package/dist/{Table-DvgBWTLx.cjs → Table-BPit83Pn.cjs} +2 -2
  146. package/dist/{Table-DvgBWTLx.cjs.map → Table-BPit83Pn.cjs.map} +1 -1
  147. package/dist/{Table-CdIQ5Wfh.js → Table-Drdhfm99.js} +15 -15
  148. package/dist/{Table-CdIQ5Wfh.js.map → Table-Drdhfm99.js.map} +1 -1
  149. package/dist/{Tabs-CejCwV3O.cjs → Tabs-BiKDy_fv.cjs} +2 -2
  150. package/dist/{Tabs-CejCwV3O.cjs.map → Tabs-BiKDy_fv.cjs.map} +1 -1
  151. package/dist/{Tabs-8-klG-y-.js → Tabs-ytbBzAxG.js} +2 -2
  152. package/dist/{Tabs-8-klG-y-.js.map → Tabs-ytbBzAxG.js.map} +1 -1
  153. package/dist/{TagsField-BQLqUckB.js → TagsField-CEt_PC5y.js} +4 -4
  154. package/dist/{TagsField-BQLqUckB.js.map → TagsField-CEt_PC5y.js.map} +1 -1
  155. package/dist/{TagsField-BSAd4eUr.cjs → TagsField-DpDbf0ru.cjs} +2 -2
  156. package/dist/{TagsField-BSAd4eUr.cjs.map → TagsField-DpDbf0ru.cjs.map} +1 -1
  157. package/dist/{TextField-B4YtjNUs.js → TextField-BWdmF-HE.js} +3 -3
  158. package/dist/{TextField-B4YtjNUs.js.map → TextField-BWdmF-HE.js.map} +1 -1
  159. package/dist/{TextField-DzYGA_St.cjs → TextField-Df_kGy2l.cjs} +2 -2
  160. package/dist/{TextField-DzYGA_St.cjs.map → TextField-Df_kGy2l.cjs.map} +1 -1
  161. package/dist/{ThemeToggle-BKk0eFiB.cjs → ThemeToggle-BJdXhmfc.cjs} +2 -2
  162. package/dist/{ThemeToggle-BKk0eFiB.cjs.map → ThemeToggle-BJdXhmfc.cjs.map} +1 -1
  163. package/dist/{ThemeToggle-B4_zRHJY.js → ThemeToggle-CgxF6oUu.js} +3 -3
  164. package/dist/{ThemeToggle-B4_zRHJY.js.map → ThemeToggle-CgxF6oUu.js.map} +1 -1
  165. package/dist/{TimeColumns-BAzRrkqY.cjs → TimeColumns-DxVN0V8l.cjs} +2 -2
  166. package/dist/{TimeColumns-BAzRrkqY.cjs.map → TimeColumns-DxVN0V8l.cjs.map} +1 -1
  167. package/dist/{TimeColumns-CAPyli9V.js → TimeColumns-n-fz50mr.js} +2 -2
  168. package/dist/{TimeColumns-CAPyli9V.js.map → TimeColumns-n-fz50mr.js.map} +1 -1
  169. package/dist/{TimePicker-BebBSlQF.js → TimePicker-Bopxx3zU.js} +5 -5
  170. package/dist/{TimePicker-BebBSlQF.js.map → TimePicker-Bopxx3zU.js.map} +1 -1
  171. package/dist/{TimePicker-BUnXYR5g.cjs → TimePicker-DvoemiGz.cjs} +2 -2
  172. package/dist/{TimePicker-BUnXYR5g.cjs.map → TimePicker-DvoemiGz.cjs.map} +1 -1
  173. package/dist/{Toaster-ywqAKP8s.js → Toaster-BxIY2H4V.js} +2 -2
  174. package/dist/{Toaster-ywqAKP8s.js.map → Toaster-BxIY2H4V.js.map} +1 -1
  175. package/dist/{Toaster-B2rO4BkG.cjs → Toaster-DZSzFse_.cjs} +2 -2
  176. package/dist/{Toaster-B2rO4BkG.cjs.map → Toaster-DZSzFse_.cjs.map} +1 -1
  177. package/dist/{TranslatedFields-DQQUb0RD.cjs → TranslatedFields-BtDLkQy7.cjs} +2 -2
  178. package/dist/{TranslatedFields-DQQUb0RD.cjs.map → TranslatedFields-BtDLkQy7.cjs.map} +1 -1
  179. package/dist/{TranslatedFields-C-wlh51E.js → TranslatedFields-DmR8LKSG.js} +5 -5
  180. package/dist/{TranslatedFields-C-wlh51E.js.map → TranslatedFields-DmR8LKSG.js.map} +1 -1
  181. package/dist/{UserCard-Be1kl0TZ.cjs → UserCard-C1yFvVIc.cjs} +2 -2
  182. package/dist/{UserCard-Be1kl0TZ.cjs.map → UserCard-C1yFvVIc.cjs.map} +1 -1
  183. package/dist/{UserCard-BqWt0S-c.js → UserCard-J8Bpbh3x.js} +3 -3
  184. package/dist/{UserCard-BqWt0S-c.js.map → UserCard-J8Bpbh3x.js.map} +1 -1
  185. package/dist/components/Alert/index.cjs +1 -1
  186. package/dist/components/Alert/index.js +1 -1
  187. package/dist/components/Blockquote/Blockquote.d.cts +1 -1
  188. package/dist/components/Blockquote/Blockquote.d.ts +1 -1
  189. package/dist/components/Blockquote/index.cjs +1 -1
  190. package/dist/components/Blockquote/index.js +1 -1
  191. package/dist/components/Breadcrumbs/index.cjs +1 -1
  192. package/dist/components/Breadcrumbs/index.js +1 -1
  193. package/dist/components/Button/index.cjs +1 -1
  194. package/dist/components/Button/index.js +1 -1
  195. package/dist/components/Card/index.cjs +1 -1
  196. package/dist/components/Card/index.js +1 -1
  197. package/dist/components/Chip/index.cjs +1 -1
  198. package/dist/components/Chip/index.js +1 -1
  199. package/dist/components/CodeBlock/index.cjs +1 -1
  200. package/dist/components/CodeBlock/index.js +1 -1
  201. package/dist/components/ColorPicker/index.cjs +1 -1
  202. package/dist/components/ColorPicker/index.js +1 -1
  203. package/dist/components/CopyButton/index.cjs +1 -1
  204. package/dist/components/CopyButton/index.js +1 -1
  205. package/dist/components/DatePicker/index.cjs +1 -1
  206. package/dist/components/DatePicker/index.js +1 -1
  207. package/dist/components/DateTimePicker/index.cjs +1 -1
  208. package/dist/components/DateTimePicker/index.js +1 -1
  209. package/dist/components/EmptyState/index.cjs +1 -1
  210. package/dist/components/EmptyState/index.js +1 -1
  211. package/dist/components/FileCard/index.cjs +1 -1
  212. package/dist/components/FileCard/index.js +1 -1
  213. package/dist/components/FileUploader/index.cjs +1 -1
  214. package/dist/components/FileUploader/index.js +1 -1
  215. package/dist/components/Flag/index.cjs +1 -1
  216. package/dist/components/Flag/index.js +1 -1
  217. package/dist/components/FullscreenToggle/index.cjs +1 -1
  218. package/dist/components/FullscreenToggle/index.js +1 -1
  219. package/dist/components/IconButton/index.cjs +1 -1
  220. package/dist/components/IconButton/index.js +1 -1
  221. package/dist/components/Loader/index.cjs +1 -1
  222. package/dist/components/Loader/index.js +1 -1
  223. package/dist/components/Modal/index.cjs +1 -1
  224. package/dist/components/Modal/index.js +1 -1
  225. package/dist/components/MultiSelect/index.cjs +1 -1
  226. package/dist/components/MultiSelect/index.js +1 -1
  227. package/dist/components/NumberField/index.cjs +1 -1
  228. package/dist/components/NumberField/index.js +1 -1
  229. package/dist/components/OtpField/OtpField.d.cts +3 -0
  230. package/dist/components/OtpField/OtpField.d.ts +3 -0
  231. package/dist/components/OtpField/index.cjs +1 -1
  232. package/dist/components/OtpField/index.d.cts +1 -1
  233. package/dist/components/OtpField/index.d.ts +1 -1
  234. package/dist/components/OtpField/index.js +1 -1
  235. package/dist/components/PageLayout/index.cjs +1 -1
  236. package/dist/components/PageLayout/index.js +1 -1
  237. package/dist/components/PageNotFound/index.cjs +1 -1
  238. package/dist/components/PageNotFound/index.js +1 -1
  239. package/dist/components/Pagination/index.cjs +1 -1
  240. package/dist/components/Pagination/index.js +1 -1
  241. package/dist/components/RemoveDialog/index.cjs +1 -1
  242. package/dist/components/RemoveDialog/index.js +1 -1
  243. package/dist/components/RichTextEditor/index.cjs +1 -1
  244. package/dist/components/RichTextEditor/index.js +1 -1
  245. package/dist/components/RootLayout/SettingsDrawer.d.cts +3 -1
  246. package/dist/components/RootLayout/SettingsDrawer.d.ts +3 -1
  247. package/dist/components/RootLayout/index.cjs +1 -1
  248. package/dist/components/RootLayout/index.js +1 -1
  249. package/dist/components/Select/index.cjs +1 -1
  250. package/dist/components/Select/index.js +1 -1
  251. package/dist/components/Sidebar/index.cjs +1 -1
  252. package/dist/components/Sidebar/index.js +1 -1
  253. package/dist/components/SpeedDial/index.cjs +1 -1
  254. package/dist/components/SpeedDial/index.js +1 -1
  255. package/dist/components/Stepper/index.cjs +1 -1
  256. package/dist/components/Stepper/index.js +1 -1
  257. package/dist/components/Table/index.cjs +1 -1
  258. package/dist/components/Table/index.js +1 -1
  259. package/dist/components/Tabs/index.cjs +1 -1
  260. package/dist/components/Tabs/index.js +1 -1
  261. package/dist/components/TagsField/index.cjs +1 -1
  262. package/dist/components/TagsField/index.js +1 -1
  263. package/dist/components/TextField/index.cjs +1 -1
  264. package/dist/components/TextField/index.js +1 -1
  265. package/dist/components/ThemeToggle/index.cjs +1 -1
  266. package/dist/components/ThemeToggle/index.js +1 -1
  267. package/dist/components/TimePicker/index.cjs +1 -1
  268. package/dist/components/TimePicker/index.js +1 -1
  269. package/dist/components/Toast/index.cjs +1 -1
  270. package/dist/components/Toast/index.js +1 -1
  271. package/dist/components/TranslatedFields/index.cjs +1 -1
  272. package/dist/components/TranslatedFields/index.js +1 -1
  273. package/dist/components/UserCard/index.cjs +1 -1
  274. package/dist/components/UserCard/index.js +1 -1
  275. package/dist/entries/app.cjs +1 -1
  276. package/dist/entries/app.js +1 -1
  277. package/dist/entries/components.cjs +1 -1
  278. package/dist/entries/components.js +41 -41
  279. package/dist/entries/i18n.cjs +1 -1
  280. package/dist/entries/i18n.js +2 -2
  281. package/dist/entries/theme.cjs +1 -1
  282. package/dist/entries/theme.d.cts +1 -1
  283. package/dist/entries/theme.d.ts +1 -1
  284. package/dist/entries/theme.js +1 -1
  285. package/dist/i18n/messages.d.cts +6 -0
  286. package/dist/i18n/messages.d.ts +6 -0
  287. package/dist/index.cjs +1 -1
  288. package/dist/index.css +25 -2
  289. package/dist/index.js +44 -44
  290. package/dist/{messages-Dvn_tEp0.cjs → messages-DKT0SRM0.cjs} +9 -9
  291. package/dist/messages-DKT0SRM0.cjs.map +1 -0
  292. package/dist/{messages-CL8uoIRj.js → messages-ogohLC5P.js} +67 -25
  293. package/dist/messages-ogohLC5P.js.map +1 -0
  294. package/dist/theme/ConfigProvider.d.cts +19 -0
  295. package/dist/theme/ConfigProvider.d.ts +19 -0
  296. package/dist/theme/index.d.cts +1 -1
  297. package/dist/theme/index.d.ts +1 -1
  298. package/package.json +1 -1
  299. package/dist/Alert-Cl1zxmX9.cjs +0 -2
  300. package/dist/Alert-D6VL2C-E.js +0 -71
  301. package/dist/Blockquote-CNIuJFHq.js +0 -46
  302. package/dist/Blockquote-CxHwOecc.cjs +0 -2
  303. package/dist/ConfigProvider-Blhvj6UQ.js +0 -296
  304. package/dist/ConfigProvider-Blhvj6UQ.js.map +0 -1
  305. package/dist/ConfigProvider-CUG8Mfy2.cjs +0 -2
  306. package/dist/ConfigProvider-CUG8Mfy2.cjs.map +0 -1
  307. package/dist/EmptyState-DlX-BLLI.cjs +0 -2
  308. package/dist/Loader-DwmyJFwG.js +0 -28
  309. package/dist/Modal-Cx0JEQ-j.js +0 -195
  310. package/dist/Modal-DXZdMmJh.cjs +0 -2
  311. package/dist/OtpField-BujZAy2A.cjs +0 -2
  312. package/dist/OtpField-BujZAy2A.cjs.map +0 -1
  313. package/dist/OtpField-D0eTOLtg.js +0 -171
  314. package/dist/OtpField-D0eTOLtg.js.map +0 -1
  315. package/dist/RootLayout-1am1CwPQ.cjs +0 -2
  316. package/dist/RootLayout-1am1CwPQ.cjs.map +0 -1
  317. package/dist/RootLayout-x7qWzXPc.js +0 -479
  318. package/dist/RootLayout-x7qWzXPc.js.map +0 -1
  319. package/dist/messages-CL8uoIRj.js.map +0 -1
  320. package/dist/messages-Dvn_tEp0.cjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RootLayout-kssj9exn.cjs","sources":["../src/components/RootLayout/SettingsDrawer.tsx","../src/components/RootLayout/ActionSet.tsx","../src/components/RootLayout/RootLayout.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { DEFAULT_FONT_FAMILY, useT, useTheme } from '../../theme'\nimport { Col } from '../Flex'\nimport { Divider } from '../Divider'\nimport { Modal } from '../Modal'\nimport { ChoiceCardGroup } from '../ChoiceCard'\nimport { Select } from '../Select'\nimport { SwatchPicker } from '../SwatchPicker'\nimport { Typography } from '../Typography'\n\n// Accent choices offered alongside the provider's default (which leads each list) — 15 per mode, so\n// each theme shows 16 total. Tuned PER MODE (deeper tones for light, brighter for dark) and paired by\n// hue (red → violet + a neutral) so a color keeps its identity across themes.\nconst ALT_SWATCHES: Record<'light' | 'dark', string[]> = {\n light: [\n '#dc2626', // red\n '#ea580c', // orange\n '#d97706', // amber\n '#ca8a04', // yellow\n '#65a30d', // lime\n '#16a34a', // green\n '#059669', // emerald\n '#0891b2', // cyan\n '#0284c7', // sky\n '#2563eb', // blue\n '#4f46e5', // indigo\n '#7c3aed', // violet\n '#c026d3', // fuchsia\n '#db2777', // pink\n '#475569', // slate\n ],\n dark: [\n '#f87171', // red\n '#fb923c', // orange\n '#fbbf24', // amber\n '#facc15', // yellow\n '#a3e635', // lime\n '#4ade80', // green\n '#34d399', // emerald\n '#22d3ee', // cyan\n '#38bdf8', // sky\n '#60a5fa', // blue\n '#818cf8', // indigo\n '#a78bfa', // violet\n '#e879f9', // fuchsia\n '#f472b6', // pink\n '#94a3b8', // slate\n ],\n}\n\nexport interface SettingsDrawerProps {\n /** Whether the drawer is open. */\n open: boolean\n /** Close handler. */\n onClose: () => void\n /** Show the light/dark **Theme** section (gated by the shell's `header.theme`, the same flag as the header toggle). */\n showTheme?: boolean\n}\n\n/**\n * The header user-menu **Settings** drawer (a right-side `Modal`), top to bottom: a **Theme** section — an\n * exclusive `ChoiceCardGroup` (**Light** / **Dark** cards) driving `useTheme().setMode`, shown only when\n * **`showTheme`** (the shell's `header.theme`, so the header toggle + this section appear/disappear\n * together); **Accent Color** — **two `SwatchPicker`s** (Light + Dark) so both accents are chosen\n * independently, each with a per-mode set (deeper tones for light, brighter for dark), calling\n * `setAccentColor(color, mode)` and persisting it — each list leads with the provider's default for that\n * mode (`defaultAccentColors[mode]`), selected when there's no override (picking it clears the override).\n * When `showTheme` is off the panel is locked to one mode, so **only the active mode's accent picker**\n * shows (the other is pointless without a theme switch);\n * a **Font** section (a searchable `Select` — Inter preset + type any Google Font — driving\n * `setFontFamily`); and a **Header** section (an exclusive `ChoiceCardGroup` **Scrollable** / **Fixed**\n * driving `setHeaderSticky`); and a **Shape** section (an exclusive `ChoiceCardGroup` **Rounded** /\n * **Square** driving `setShape` — `square` flattens every corner in the panel to `border-radius: 0`).\n * Internal to the admin shell — not a public export.\n */\nexport function SettingsDrawer({ open, onClose, showTheme = true }: SettingsDrawerProps) {\n const {\n mode,\n setMode,\n accentColors,\n defaultAccentColors,\n setAccentColor,\n headerSticky,\n setHeaderSticky,\n fontFamily,\n setFontFamily,\n shape,\n setShape,\n } = useTheme()\n const t = useT()\n\n // One searchable Select doubles as a \"type any Google Font\" field. Base = Inter (the only preset) +\n // the active font (so a custom pick stays visible/selectable). While searching, the typed query is\n // offered as its own option — picking it applies + loads that family. Base is always kept in the\n // list (never filtered out) so `value` always resolves in the trigger, even mid-search.\n const [fontQuery, setFontQuery] = useState('')\n const q = fontQuery.trim()\n const base =\n fontFamily !== DEFAULT_FONT_FAMILY ? [DEFAULT_FONT_FAMILY, fontFamily] : [DEFAULT_FONT_FAMILY]\n const showTyped = q.length > 0 && !base.some((f) => f.toLowerCase() === q.toLowerCase())\n const fontOptions = (showTyped ? [q, ...base] : base).map((f) => ({\n value: f,\n label: f === DEFAULT_FONT_FAMILY ? t('settings.fontDefault', { font: f }) : f,\n }))\n\n const picker = (mode: 'light' | 'dark', label: string) => {\n const def = defaultAccentColors[mode]\n // the provider's default (per mode) leads the list; then the mode's alts (minus any collision)\n const colors = [def, ...ALT_SWATCHES[mode].filter((c) => c.toLowerCase() !== def.toLowerCase())]\n return (\n <SwatchPicker\n label={label}\n colors={colors}\n // with no override, this mode's default swatch reads as selected\n value={accentColors[mode] ?? def}\n // the default swatch clears this mode's override; the rest set it\n onChange={(color) =>\n setAccentColor(color.toLowerCase() === def.toLowerCase() ? null : color, mode)\n }\n labels={{ [def]: t('settings.accentDefault', { color: def }) }}\n aria-label={String(label)}\n />\n )\n }\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n placement=\"right\"\n size=\"sm\"\n title={t('settings.label')}\n icon=\"Setting5\"\n >\n {showTheme && (\n <>\n <Typography variant=\"subtitle\" as=\"h3\">\n {t('settings.themeTitle')}\n </Typography>\n <Typography\n variant=\"bodySmall\"\n color=\"muted\"\n as=\"p\"\n style={{ marginTop: 'var(--tz-space-xxs)' }}\n >\n {t('settings.themeDesc')}\n </Typography>\n <ChoiceCardGroup\n exclusive\n color=\"accent\"\n minCardWidth={130}\n value={mode}\n onChange={(v) => {\n if (typeof v === 'string') setMode(v as 'light' | 'dark')\n }}\n options={[\n {\n value: 'light',\n label: t('settings.light'),\n description: t('settings.lightDesc'),\n icon: 'Sun',\n },\n {\n value: 'dark',\n label: t('settings.dark'),\n description: t('settings.darkDesc'),\n icon: 'Moon',\n },\n ]}\n aria-label={t('settings.themeTitle')}\n style={{ marginTop: 'var(--tz-space-sm)' }}\n />\n\n <Divider style={{ margin: 'var(--tz-space-md) 0' }} />\n </>\n )}\n\n <Typography variant=\"subtitle\" as=\"h3\">\n {t('settings.accentTitle')}\n </Typography>\n <Typography\n variant=\"bodySmall\"\n color=\"muted\"\n as=\"p\"\n style={{ marginTop: 'var(--tz-space-xxs)' }}\n >\n {t('settings.accentDesc')}\n </Typography>\n <Col gap=\"md\" style={{ marginTop: 'var(--tz-space-sm)' }}>\n {showTheme ? (\n <>\n {picker('light', t('settings.lightTheme'))}\n {picker('dark', t('settings.darkTheme'))}\n </>\n ) : (\n // theme switching is off → the panel stays in one mode, so only that mode's accent matters\n picker(mode, mode === 'light' ? t('settings.lightTheme') : t('settings.darkTheme'))\n )}\n </Col>\n\n <Divider style={{ margin: 'var(--tz-space-md) 0' }} />\n\n <Typography variant=\"subtitle\" as=\"h3\">\n {t('settings.fontTitle')}\n </Typography>\n <Typography\n variant=\"bodySmall\"\n color=\"muted\"\n as=\"p\"\n style={{ marginTop: 'var(--tz-space-xxs)' }}\n >\n {t('settings.fontDesc')}\n </Typography>\n <Select\n label={t('settings.fontFamily')}\n searchable\n searchPlaceholder={t('settings.fontSearch')}\n value={fontFamily}\n options={fontOptions}\n onSearchChange={setFontQuery}\n onChange={(v) => {\n setFontFamily(v)\n setFontQuery('')\n }}\n aria-label={t('settings.fontFamily')}\n style={{ marginTop: 'var(--tz-space-sm)' }}\n />\n\n <Divider style={{ margin: 'var(--tz-space-md) 0' }} />\n\n <Typography variant=\"subtitle\" as=\"h3\">\n {t('settings.headerTitle')}\n </Typography>\n <Typography\n variant=\"bodySmall\"\n color=\"muted\"\n as=\"p\"\n style={{ marginTop: 'var(--tz-space-xxs)' }}\n >\n {t('settings.headerDesc')}\n </Typography>\n <ChoiceCardGroup\n exclusive\n color=\"accent\"\n minCardWidth={130}\n value={headerSticky ? 'fixed' : 'static'}\n // exclusive (radio) → always a string; set sticky from the picked card\n onChange={(v) => {\n if (typeof v === 'string') setHeaderSticky(v === 'fixed')\n }}\n options={[\n {\n value: 'static',\n label: t('settings.scrollable'),\n description: t('settings.scrollableDesc'),\n },\n { value: 'fixed', label: t('settings.fixed'), description: t('settings.fixedDesc') },\n ]}\n aria-label={t('settings.headerTitle')}\n style={{ marginTop: 'var(--tz-space-sm)' }}\n />\n\n <Divider style={{ margin: 'var(--tz-space-md) 0' }} />\n\n <Typography variant=\"subtitle\" as=\"h3\">\n {t('settings.shapeTitle')}\n </Typography>\n <Typography\n variant=\"bodySmall\"\n color=\"muted\"\n as=\"p\"\n style={{ marginTop: 'var(--tz-space-xxs)' }}\n >\n {t('settings.shapeDesc')}\n </Typography>\n <ChoiceCardGroup\n exclusive\n color=\"accent\"\n minCardWidth={130}\n value={shape}\n // exclusive (radio) → always a string; the two values are exactly the ThemeShape union\n onChange={(v) => {\n if (v === 'rounded' || v === 'square') setShape(v)\n }}\n options={[\n {\n value: 'rounded',\n label: t('settings.rounded'),\n description: t('settings.roundedDesc'),\n },\n { value: 'square', label: t('settings.square'), description: t('settings.squareDesc') },\n ]}\n aria-label={t('settings.shapeTitle')}\n style={{ marginTop: 'var(--tz-space-sm)' }}\n />\n </Modal>\n )\n}\n","import { type MouseEvent, type ReactNode } from 'react'\nimport { useMediaQuery } from '../../hooks/useMediaQuery'\nimport { useT, type ThemeColor } from '../../theme'\nimport type { IconName } from '../../icons/names'\nimport { Button, type ButtonVariant } from '../Button'\nimport { Icon } from '../Icon'\nimport { SpeedDial } from '../SpeedDial'\nimport styles from './RootLayout.module.css'\n\n/** A resolved page action — rendered as a `Button` (inline) or a `SpeedDial` action (collapsed). */\nexport interface PageAction {\n /** Visible label (button text; the SpeedDial action's tooltip when collapsed). */\n label: ReactNode\n /** Leading icon — an `IconName` or any node. When omitted, the collapsed dial shows the label's first letter. */\n icon?: IconName | ReactNode\n /** Click handler. */\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void\n /** Button color / tint. */\n color?: ThemeColor\n /** Inline-button variant (ignored when collapsed). Defaults to `contained`. */\n variant?: ButtonVariant\n /** Renders the action disabled. */\n disabled?: boolean\n}\n\nconst iconNode = (icon: IconName | ReactNode) =>\n typeof icon === 'string' ? <Icon name={icon as IconName} /> : icon\n\n/** The collapsed SpeedDial action's icon: the action's `icon`, else the label's first letter (uppercased),\n * else a fallback `More` glyph when the label isn't a plain string. */\nconst speedDialIcon = (a: PageAction): IconName | ReactNode => {\n if (a.icon != null) return a.icon\n if (typeof a.label === 'string' && a.label.trim())\n return <span className={styles.pageActionsLetter}>{a.label.trim()[0].toUpperCase()}</span>\n return 'More'\n}\n\n/**\n * Renders a set of page actions in the shell's page-title row: inline `Button`s on wider screens,\n * **collapsed into a `SpeedDial`** (a fixed bottom-right FAB) on the `xs` breakpoint (≤767.98px) when\n * there are **2 or more**. Fed by a route's `staticData.actions` (resolved by `RootLayout`). Internal.\n */\nexport function ActionSet({ actions }: { actions: PageAction[] }) {\n const t = useT()\n // ≤ 767.98px — collapse 2+ actions into a SpeedDial so a row of buttons doesn't crowd a phone header\n const isXs = useMediaQuery('xs')\n if (!actions.length) return null\n\n return isXs && actions.length >= 2 ? (\n <SpeedDial\n ariaLabel={t('pageActions.label')}\n icon=\"Add\"\n direction=\"up\"\n // float it as a fixed bottom-right FAB (out of the title-row flow); inset tightens on xxs\n className={styles.pageActionsFab}\n actions={actions.map((a) => ({\n icon: speedDialIcon(a),\n label: a.label,\n onClick: a.onClick,\n disabled: a.disabled,\n }))}\n />\n ) : (\n <>\n {actions.map((a, i) => (\n <Button\n key={i}\n size=\"sm\"\n color={a.color}\n variant={a.variant}\n disabled={a.disabled}\n startIcon={a.icon != null ? iconNode(a.icon) : undefined}\n onClick={a.onClick}\n >\n {a.label}\n </Button>\n ))}\n </>\n )\n}\n","import { useEffect, useState, type ReactNode } from 'react'\nimport { useNavigate, useRouterState, type LinkProps } from '@tanstack/react-router'\nimport { clsx } from 'clsx'\nimport { useMediaQuery } from '../../hooks/useMediaQuery'\nimport { useLockBodyScroll } from '../../hooks/useLockBodyScroll'\nimport {\n useHeaderConfig,\n useLanguage,\n useT,\n useTheme,\n type HeaderConfig,\n type HeaderUser,\n} from '../../theme'\nimport { Avatar } from '../Avatar'\nimport { Col, Row } from '../Flex'\nimport { Divider } from '../Divider'\nimport { Dropdown } from '../Dropdown'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { ListItem } from '../List'\nimport { FullscreenToggle } from '../FullscreenToggle'\nimport { ThemeToggle } from '../ThemeToggle'\nimport { Typography } from '../Typography'\nimport { Breadcrumbs } from '../Breadcrumbs'\nimport { Toaster, type ToasterProps } from '../Toast'\nimport { NavSearch, Sidebar, useLeafActions, usePageBack, usePageTitle } from '../Sidebar/Sidebar'\nimport { Flag } from '../Flag'\nimport { SettingsDrawer } from './SettingsDrawer'\nimport { ActionSet, type PageAction } from './ActionSet'\nimport styles from './RootLayout.module.css'\n\n/**\n * The shell header config + its user shape now live in the theme layer (so `config.header` can carry\n * them app-wide). These aliases keep the historical `RootLayout*` names importable.\n */\nexport type RootLayoutUser = HeaderUser\nexport type RootLayoutHeader = HeaderConfig\n\nexport interface RootLayoutProps {\n /** Brand logo at the top of the sidebar card — pass an `<img>`, an `<Icon>`, or any node. */\n logo?: ReactNode\n /** Optional content pinned to the **bottom of the sidebar** (e.g. a promo / \"Need help?\" card). */\n sidebarFooter?: ReactNode\n /**\n * Header config for **this** shell — merged **over** the app-wide `config.header` (the prop wins).\n * Fields: the built-in `theme` / `search` / `settings` / `languages` toggles (default `true`),\n * `fullscreen` (default `false`), `breadcrumbs` (default `true`), `pageTitle` (default `true`), and the\n * account (`onLogout` / `user`).\n */\n header?: RootLayoutHeader\n /**\n * The built-in toast viewport, mounted for you so `toast.*()` works app-wide with no extra setup.\n * Defaults to `true` (a `<Toaster>` with its defaults). Pass `ToasterProps` to configure it\n * (`{ position, duration }`), or `false` to opt out — e.g. when you mount your own `<Toaster>`.\n */\n toaster?: boolean | ToasterProps\n /** Routed content — the consumer passes `<Outlet />`. */\n children: ReactNode\n}\n\n/**\n * The admin-panel shell — a **floating** layout: the whole app sits on a soft `--tz-color-background`\n * canvas, with a rounded, elevated `--tz-color-surface` **sidebar card** (`logo` + auto-generated `Sidebar` + an optional\n * `sidebarFooter`) beside the header + content. Set it as the root route's component and pass\n * `<Outlet />` as `children`; the `Sidebar` builds itself from the routes' `staticData`. The header\n * holds an optional `ThemeToggle` (on by default), a **Settings** button (opens a right-side drawer to\n * pick + persist the `accent` color), plus an account `Avatar` whose menu has a **Sign out** item when\n * `header.onLogout` is given. The content area stacks\n * **`Breadcrumbs` → the page title (the active route's `staticData.name`) → `children`**; pages wrap\n * their own body in `PageLayout`. Set `header.pageTitle = false` to drop the auto `h2` when pages\n * carry their own heading inside their `PageLayout` header. On a 404 the auto title + breadcrumbs are\n * suppressed automatically (a partial route match would otherwise show a stale section), regardless of\n * the `header.pageTitle` / `header.breadcrumbs` props. A `<Toaster>` is **mounted by default** so\n * `toast.*()` works app-wide with no extra setup (configure via `toaster`, or `toaster={false}` to opt\n * out). Styling is token-based, so it follows the active `ConfigProvider` mode. Requires\n * `@tanstack/react-router` (peer).\n */\nexport function RootLayout({\n logo,\n sidebarFooter,\n header,\n toaster = true,\n children,\n}: RootLayoutProps) {\n const title = usePageTitle()\n const onBack = usePageBack() // set by the current route's `staticData.back` (opt-in) — else undefined\n // header sticky/static — the user's persisted choice (seeded from config.header.sticky)\n const { headerSticky } = useTheme()\n const { language, setLanguage, languages } = useLanguage()\n const t = useT()\n // app-wide header config (config.header) as the base; this shell's `header` prop wins over it\n const configHeader = useHeaderConfig()\n const h: HeaderConfig = { ...configHeader, ...header }\n const showTheme = h.theme ?? true\n const showFullscreen = h.fullscreen ?? false\n const showSettings = h.settings ?? true\n const showSearch = h.search ?? true\n const showLanguages = h.languages ?? true\n const showBreadcrumbs = h.breadcrumbs ?? true\n const toasterProps = typeof toaster === 'object' ? toaster : undefined\n const showPageTitle = h.pageTitle ?? true\n const onLogout = h.onLogout\n const user = h.user\n const accountMenu = h.menu ?? [] // custom account-menu items (between the user block and Sign out)\n // below 1280px the sidebar auto-collapses (and auto-expands again above it); a manual toggle holds\n // until the next breakpoint cross. `useMediaQuery` is correct on the first client render, so no flash.\n const isNarrow = useMediaQuery('md') // ≤ 1279.98px — the shared `md` breakpoint\n const [collapsed, setCollapsed] = useState(isNarrow)\n useEffect(() => {\n setCollapsed(isNarrow)\n }, [isNarrow])\n // while the sidebar overlays the content (narrow + open), lock page scroll so scrolling inside the\n // drawer doesn't scroll the content behind it\n useLockBodyScroll(isNarrow && !collapsed)\n // navigating from the overlay drawer (a nav link or a search suggestion — both change the route) auto-\n // closes it, so you land on the page instead of the still-open sidebar; desktop navigation is untouched\n const pathname = useRouterState({ select: (s) => s.location.pathname })\n useEffect(() => {\n if (isNarrow) setCollapsed(true)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [pathname])\n // on a 404 the URL often partially matches a named layout route (e.g. `/core/xxx` still resolves\n // \"Core\" as the active section), so the auto page title + breadcrumbs would show a stale, wrong trail.\n // suppress both when the router is in a notFound state — automatic, no opt-out needed. `statusCode ===\n // 404` is the primary signal; a `notFound` match status is the fallback.\n const isNotFound = useRouterState({\n select: (s) => s.statusCode === 404 || s.matches.some((m) => m.status === 'notFound'),\n })\n const [settingsOpen, setSettingsOpen] = useState(false)\n // declarative page-title-row actions from the current route's `staticData.actions` — `to` navigates\n // via the router; `onClick` is a plain handler. Resolved to the `ActionSet` shape here.\n const navigate = useNavigate()\n const routeActions = useLeafActions()\n const pageActions: PageAction[] = (routeActions ?? []).map((a) => ({\n label: a.label,\n icon: a.icon,\n color: a.color,\n variant: a.variant,\n disabled: a.disabled,\n onClick:\n a.onClick ??\n (a.to\n ? () =>\n navigate({ to: a.to as LinkProps['to'], params: a.params, search: a.search } as never)\n : undefined),\n }))\n\n return (\n <div className={clsx(styles.shell, collapsed && styles.shellCollapsed)}>\n <aside className={styles.sidebar}>\n {/* fixed-width inner: the outer <aside> animates its width to 0 (and clips via overflow),\n while this keeps the sidebar's real width so the content never reflows mid-collapse */}\n <div className={styles.sidebarInner}>\n {logo ? (\n <div className={styles.brand}>\n {logo}\n {/* in-drawer close — only shown when the sidebar overlays (narrow), where the header\n toggle is behind the backdrop; closes the drawer */}\n <IconButton\n variant=\"filled\"\n size=\"sm\"\n className={styles.sidebarClose}\n aria-label={t('common.close')}\n onClick={() => setCollapsed(true)}\n >\n <Icon name=\"Close\" />\n </IconButton>\n </div>\n ) : null}\n {/* the search lives in the header on desktop; below 576px (full-width drawer) it moves here,\n between the logo and the menu (CSS toggles which instance shows) */}\n {showSearch ? (\n <div className={styles.sidebarSearch}>\n <NavSearch />\n </div>\n ) : null}\n <div className={styles.navScroll}>\n <Sidebar />\n </div>\n {sidebarFooter ? <div className={styles.sidebarFooter}>{sidebarFooter}</div> : null}\n </div>\n </aside>\n {/* dim backdrop behind the overlay sidebar — a sibling of the sidebar (same stacking context, so the\n sidebar reliably sits above it, unlike a body-portaled Overlay). Only shown/interactive below\n 1280px while open (CSS); clicking it closes the drawer. On desktop the sidebar is a grid column. */}\n <div className={styles.backdrop} onClick={() => setCollapsed(true)} aria-hidden=\"true\" />\n <div className={styles.main}>\n <header className={clsx(styles.topbar, headerSticky && styles.topbarSticky)}>\n <div className={styles.headerStart}>\n <IconButton\n aria-label={collapsed ? 'Show sidebar' : 'Hide sidebar'}\n aria-expanded={!collapsed}\n variant=\"filled\"\n size=\"sm\"\n onClick={() => setCollapsed((c) => !c)}\n >\n <Icon name=\"Menu\" />\n </IconButton>\n {showSearch ? (\n <div className={styles.headerSearch}>\n <NavSearch />\n </div>\n ) : null}\n </div>\n <div className={styles.headerEnd}>\n {showFullscreen ? <FullscreenToggle variant=\"filled\" size=\"sm\" /> : null}\n {showTheme ? <ThemeToggle variant=\"filled\" size=\"sm\" /> : null}\n {showLanguages && languages.length > 1 ? (\n <Dropdown\n placement=\"bottom-end\"\n trigger={\n <IconButton variant=\"filled\" size=\"sm\" aria-label={t('language.label')}>\n <Icon name=\"Global\" />\n </IconButton>\n }\n >\n {languages.map((l) => (\n <ListItem\n key={l.code}\n clickable\n selected={l.code === language}\n onClick={() => setLanguage(l.code)}\n icon={<Flag code={l.code} />}\n >\n {l.label ?? l.code}\n </ListItem>\n ))}\n </Dropdown>\n ) : null}\n {showSettings ? (\n <IconButton\n aria-label={t('settings.label')}\n variant=\"text\"\n size=\"sm\"\n className={styles.settings}\n onClick={() => setSettingsOpen(true)}\n >\n <Icon name=\"Setting5\" />\n </IconButton>\n ) : null}\n {onLogout ? (\n <Dropdown\n placement=\"bottom-end\"\n style={{ minWidth: 230 }}\n trigger={\n <button type=\"button\" className={styles.account} aria-label={t('account.label')}>\n <Avatar size=\"md\" name={user?.name} src={user?.avatar} color=\"primary\" />\n </button>\n }\n >\n {user ? (\n <>\n <Row gap={8} align=\"center\" padding=\"var(--tz-space-xxs) var(--tz-space-xs)\">\n <Avatar size=\"md\" name={user.name} src={user.avatar} color=\"primary\" />\n <Col gap={2}>\n {/* name, or a \"Welcome\" greeting fallback when no name is given */}\n <Typography variant=\"body\">{user.name ?? t('userCard.welcome')}</Typography>\n {user.email ? (\n <Typography variant=\"bodySmall\" color=\"muted\">\n {user.email}\n </Typography>\n ) : null}\n </Col>\n </Row>\n <Divider />\n </>\n ) : null}\n {/* app-supplied items (e.g. \"Account\"), between the user block and Sign out */}\n {accountMenu.map((item, i) => (\n <ListItem\n key={i}\n icon={item.icon ? <Icon name={item.icon} color={item.color} /> : undefined}\n color={item.color}\n clickable\n disabled={item.disabled}\n onClick={item.onClick}\n >\n {item.label}\n </ListItem>\n ))}\n {/* keep the destructive Sign out visually separated from the custom items */}\n {accountMenu.length > 0 ? <Divider /> : null}\n <ListItem icon={<Icon name=\"Logout2\" color=\"error\" />} clickable onClick={onLogout}>\n {t('userCard.signOut')}\n </ListItem>\n </Dropdown>\n ) : null}\n </div>\n </header>\n <main className={styles.content}>\n {showBreadcrumbs && !isNotFound ? <Breadcrumbs /> : null}\n {showPageTitle && !isNotFound && (title || onBack) ? (\n <div className={styles.pageTitleRow}>\n {onBack ? (\n <IconButton\n aria-label={t('pageTitle.back')}\n variant=\"filled\"\n color=\"accent\"\n className={styles.backButton}\n onClick={onBack}\n size=\"sm\"\n >\n <Icon name=\"ArrowLeft\" />\n </IconButton>\n ) : null}\n {title ? (\n <Typography variant=\"h2\" className={styles.pageTitle}>\n {title}\n </Typography>\n ) : null}\n {/* right-aligned page actions from the route's `staticData.actions` */}\n {pageActions.length > 0 ? (\n <div className={styles.pageActions}>\n <ActionSet actions={pageActions} />\n </div>\n ) : null}\n </div>\n ) : null}\n {children}\n </main>\n </div>\n {toaster !== false && <Toaster {...toasterProps} />}\n {showSettings ? (\n <SettingsDrawer\n open={settingsOpen}\n onClose={() => setSettingsOpen(false)}\n showTheme={showTheme}\n />\n ) : null}\n </div>\n )\n}\n"],"names":["ALT_SWATCHES","SettingsDrawer","open","onClose","showTheme","mode","setMode","accentColors","defaultAccentColors","setAccentColor","headerSticky","setHeaderSticky","fontFamily","setFontFamily","shape","setShape","useTheme","t","useT","fontQuery","setFontQuery","useState","q","base","DEFAULT_FONT_FAMILY","fontOptions","f","picker","label","def","colors","c","jsx","SwatchPicker","color","jsxs","Modal","Fragment","Typography","ChoiceCardGroup","v","Divider","Col","Select","iconNode","icon","Icon","speedDialIcon","a","styles","ActionSet","actions","isXs","useMediaQuery","SpeedDial","i","Button","RootLayout","logo","sidebarFooter","header","toaster","children","title","usePageTitle","onBack","usePageBack","language","setLanguage","languages","useLanguage","h","useHeaderConfig","showFullscreen","showSettings","showSearch","showLanguages","showBreadcrumbs","toasterProps","showPageTitle","onLogout","user","accountMenu","isNarrow","collapsed","setCollapsed","useEffect","useLockBodyScroll","pathname","useRouterState","s","isNotFound","m","settingsOpen","setSettingsOpen","navigate","useNavigate","pageActions","useLeafActions","clsx","IconButton","NavSearch","Sidebar","FullscreenToggle","ThemeToggle","Dropdown","l","ListItem","Flag","Avatar","Row","item","Breadcrumbs","Toaster"],"mappings":"i/BAaMA,GAAmD,CACvD,MAAO,CACL,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,SAAA,EAEF,KAAM,CACJ,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,SAAA,CAEJ,EA2BO,SAASC,GAAe,CAAE,KAAAC,EAAM,QAAAC,EAAS,UAAAC,EAAY,IAA6B,CACvF,KAAM,CACJ,KAAAC,EACA,QAAAC,EACA,aAAAC,EACA,oBAAAC,EACA,eAAAC,EACA,aAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,cAAAC,EACA,MAAAC,EACA,SAAAC,CAAA,EACEC,WAAA,EACEC,EAAIC,EAAAA,KAAA,EAMJ,CAACC,EAAWC,CAAY,EAAIC,EAAAA,SAAS,EAAE,EACvCC,EAAIH,EAAU,KAAA,EACdI,EACJX,IAAeY,EAAAA,oBAAsB,CAACA,EAAAA,oBAAqBZ,CAAU,EAAI,CAACY,qBAAmB,EAEzFC,GADYH,EAAE,OAAS,GAAK,CAACC,EAAK,KAAMG,GAAMA,EAAE,YAAA,IAAkBJ,EAAE,aAAa,EACtD,CAACA,EAAG,GAAGC,CAAI,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B,EAAAA,IAACkB,GAAA,CAAU,QAAS+C,CAAA,CAAa,EACnC,EACE,IAAA,CAAA,CACN,EACE,KACHnC,CAAA,CAAA,CACH,CAAA,EACF,EACCD,IAAY,IAAS7B,EAAAA,IAACiF,GAAAA,QAAA,CAAS,GAAGnC,CAAA,CAAc,EAChDJ,EACC1C,EAAAA,IAAC/B,GAAA,CACC,KAAM4F,EACN,QAAS,IAAMC,EAAgB,EAAK,EACpC,UAAA1F,CAAA,CAAA,EAEA,IAAA,EACN,CAEJ"}
@@ -1,2 +1,2 @@
1
- "use strict";const s=require("react/jsx-runtime"),n=require("react"),M=require("clsx"),Te=require("./formContext-bTWrqdEV.cjs"),De=require("./FloatingPanel-U6sGYiSK.cjs"),Le=require("./names-BJnFU_5m.cjs"),T=require("./Icon-BVULqOJD.cjs"),Ce=require("./List-ChXO0Hz-.cjs"),Ee=require("./ListItem-yXXjtepZ.cjs"),Se=require("./Loader-CxLrhAz9.cjs"),O=require("./Typography-BFatE1_A.cjs"),Re=require("./ConfigProvider-CUG8Mfy2.cjs"),Me="_field_17o9l_1",Oe="_fullWidth_17o9l_7",Pe="_label_17o9l_13",Ae="_required_17o9l_22",Be="_control_17o9l_28",Ke="_open_17o9l_47",We="_error_17o9l_52",Fe="_disabled_17o9l_60",Ve="_value_17o9l_70",$e="_valueIcon_17o9l_78",He="_valueLabel_17o9l_82",Qe="_placeholder_17o9l_87",ze="_clear_17o9l_92",Ue="_chevron_17o9l_111",Ge="_sm_17o9l_121",Je="_md_17o9l_125",Xe="_lg_17o9l_129",Ye="_helper_17o9l_134",Ze="_popover_17o9l_139",el="_search_17o9l_147",ll="_searchIcon_17o9l_156",sl="_searchInput_17o9l_160",ol="_listbox_17o9l_176",rl="_active_17o9l_184",tl="_noOptions_17o9l_188",nl="_loading_17o9l_194",o={field:Me,fullWidth:Oe,label:Pe,required:Ae,control:Be,open:Ke,error:We,disabled:Fe,value:Ve,valueIcon:$e,valueLabel:He,placeholder:Qe,clear:ze,chevron:Ue,sm:Ge,md:Je,lg:Xe,helper:Ye,popover:Ze,search:el,searchIcon:ll,searchInput:sl,listbox:ol,active:rl,noOptions:tl,loading:nl},al=new Set(Le.ICON_NAMES);function cl(m,h){return m==null?null:typeof m=="string"&&al.has(m)?s.jsx(T.Icon,{name:m,size:h}):m}const il=n.forwardRef(function({label:h,options:D,size:y="md",error:te,helperText:ne,required:Q=!1,fullWidth:ae=!0,disabled:p=!1,value:P,defaultValue:ce,onChange:A,placeholder:ie,clearable:ue=!0,searchable:u=!1,searchPlaceholder:de,onSearchChange:g,loading:fe=!1,loadingText:pe,noOptionsText:L,showSelectedTick:_e=!0,name:v,id:me,className:he,style:ve},j){const be=n.useId(),w=me??be,B=`${w}-label`,K=`${w}-listbox`,z=`${w}-helper`,W=e=>`${w}-opt-${e}`,N=Re.useT(),U=de??N("common.search"),C=Te.useFormContext(),E=!!(C&&v),c=E?C.field(v):void 0,xe=P!==void 0?P:E?C.values[v]??"":void 0,G=P!==void 0||E,[Ie,ye]=n.useState(ce??""),S=G?xe:Ie,F=te??(c==null?void 0:c.error)??!1,V=ne??(c==null?void 0:c.helperText),_=D.find(e=>e.value===S),ge=_!=null,J=e=>{G||ye(e),E&&C.setValue(v,e),A==null||A(e)},b=n.useRef(null),X=n.useRef(null),$=n.useRef({buffer:"",timer:0}),R=n.useRef(void 0);R.current=c?()=>c.onBlur({}):void 0;const[r,Y]=n.useState(!1),[x,Z]=n.useState(""),[d,i]=n.useState(-1),je=n.useCallback(e=>{b.current=e,typeof j=="function"?j(e):j&&(j.current=e)},[j]),a=n.useMemo(()=>{if(!u||g||!x.trim())return D;const e=x.trim().toLowerCase();return D.filter(l=>l.label.toLowerCase().includes(e))},[u,g,x,D]),I=n.useCallback((e,l)=>{let t=e;for(;t>=0&&t<a.length;){if(!a[t].disabled)return t;t+=l}return-1},[a]),ee=n.useRef(null),k=n.useCallback(e=>{var l,t;Y(!1),Z(""),window.clearTimeout($.current.timer),$.current.buffer="",(l=R.current)==null||l.call(R),e&&((t=b.current)==null||t.focus())},[]);n.useEffect(()=>{if(!r)return;const e=a.findIndex(l=>l.value===S);i(e>=0&&!a[e].disabled?e:I(0,1)),u&&requestAnimationFrame(()=>{var l;return(l=X.current)==null?void 0:l.focus()})},[r]),n.useEffect(()=>{var e,l;!r||d<0||(l=(e=document.getElementById(W(d)))==null?void 0:e.scrollIntoView)==null||l.call(e,{block:"nearest"})},[r,d]),n.useEffect(()=>{r&&u&&i(I(0,1))},[x]),n.useEffect(()=>{r&&i(e=>e<a.length?e:I(0,1))},[a.length]);const q=()=>{p||Y(!0)},H=e=>{!e||e.disabled||(J(e.value),k(!0))},le=e=>{i(l=>{const t=l<0?e>0?0:a.length-1:l+e,f=I(t,e);return f===-1?l:f})},we=e=>{const l=$.current;window.clearTimeout(l.timer),l.buffer+=e.toLowerCase(),l.timer=window.setTimeout(()=>l.buffer="",500);const t=a.findIndex(f=>!f.disabled&&f.label.toLowerCase().startsWith(l.buffer));t>=0&&i(t)},se=e=>{if(!p)switch(e.key){case"ArrowDown":e.preventDefault(),r?le(1):q();break;case"ArrowUp":e.preventDefault(),r?le(-1):q();break;case"Enter":e.preventDefault(),r?H(a[d]):q();break;case" ":r?u||(e.preventDefault(),H(a[d])):(e.preventDefault(),q());break;case"Escape":r&&(e.preventDefault(),e.stopPropagation(),k(!0));break;case"Tab":r&&k(!0);break;case"Home":r&&(e.preventDefault(),i(I(0,1)));break;case"End":r&&(e.preventDefault(),i(I(a.length-1,-1)));break;default:!u&&r&&e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&we(e.key)}},Ne=e=>{var t,f;const l=e.relatedTarget;l&&((t=ee.current)!=null&&t.contains(l)||(f=b.current)!=null&&f.contains(l))||c==null||c.onBlur(e)},ke=e=>{var l;e.stopPropagation(),J(""),(l=b.current)==null||l.focus()},oe=r&&d>=0?W(d):void 0,qe=y==="sm"?"sm":"md",re=y==="sm"?16:y==="md"?14:12;return s.jsxs("div",{className:M.clsx(o.field,o[y],ae&&o.fullWidth,F&&o.error,p&&o.disabled,he),style:ve,children:[h!=null&&s.jsxs("span",{id:B,className:o.label,onClick:()=>{var e;return!p&&((e=b.current)==null?void 0:e.focus())},children:[s.jsx(O.Typography,{as:"span",variant:"bodySmall",color:"muted",children:h}),Q&&s.jsx("span",{className:o.required,"aria-hidden":"true",children:"*"})]}),s.jsxs("div",{ref:je,id:w,...v?{name:v}:{},role:"combobox",tabIndex:p?-1:0,"aria-haspopup":"listbox","aria-expanded":r,"aria-controls":r?K:void 0,"aria-activedescendant":u?void 0:oe,"aria-labelledby":h!=null?B:void 0,"aria-disabled":p||void 0,"aria-required":Q||void 0,"aria-invalid":F||void 0,"aria-describedby":V!=null?z:void 0,className:M.clsx(o.control,r&&o.open),onClick:()=>r?k(!1):q(),onKeyDown:se,onBlur:Ne,children:[s.jsxs("span",{className:M.clsx(o.value,!ge&&o.placeholder),children:[(_==null?void 0:_.icon)!=null&&s.jsx("span",{className:o.valueIcon,children:cl(_.icon,qe)}),s.jsx("span",{className:o.valueLabel,children:_?_.label:ie??N("select.placeholder")})]}),ue&&S!==""&&!p&&s.jsx("button",{type:"button",className:o.clear,"aria-label":N("select.clear"),tabIndex:-1,onMouseDown:e=>e.preventDefault(),onClick:ke,children:s.jsx(T.Icon,{name:"CloseCircle",size:"sm"})}),s.jsx(T.Icon,{name:"ArrowDown4",className:o.chevron,style:{width:re,height:re},"aria-hidden":"true"})]}),s.jsxs(De.FloatingPanel,{ref:ee,open:r,triggerRef:b,onClose:k,matchTriggerWidth:!0,className:o.popover,children:[u&&s.jsxs("div",{className:o.search,children:[s.jsx(T.Icon,{name:"SearchNormal",size:"sm",className:o.searchIcon,"aria-hidden":"true"}),s.jsx("input",{ref:X,className:o.searchInput,type:"text",role:"combobox","aria-expanded":"true","aria-controls":K,"aria-activedescendant":oe,"aria-autocomplete":"list","aria-label":U,placeholder:U,value:x,spellCheck:!1,onChange:e=>{Z(e.target.value),g==null||g(e.target.value)},onKeyDown:se})]}),s.jsx(Ce.List,{role:"listbox",id:K,"aria-labelledby":h!=null?B:void 0,size:y,className:o.listbox,onMouseLeave:()=>i(-1),children:fe?s.jsxs("div",{className:o.loading,children:[s.jsx(Se.Loader,{size:"sm"}),s.jsx(O.Typography,{as:"span",variant:"bodySmall",color:"muted",children:pe??N("common.loading")})]}):a.length===0?s.jsx("div",{className:o.noOptions,children:s.jsx(O.Typography,{as:"span",variant:"bodySmall",color:"muted",children:L==null?N("select.noOptions"):typeof L=="function"?L(x):L})}):a.map((e,l)=>{const t=e.value===S;return s.jsx(Ee.ListItem,{id:W(l),role:"option",tabIndex:-1,"aria-selected":t,"aria-current":void 0,clickable:!0,selected:t,disabled:e.disabled,icon:e.icon,className:M.clsx(l===d&&o.active),trailing:t&&_e?s.jsx(T.Icon,{name:"TickCircle",size:"sm"}):void 0,onMouseEnter:()=>!e.disabled&&i(l),onClick:()=>H(e),children:e.label},e.value)})})]}),V!=null&&s.jsx(O.Typography,{as:"span",id:z,variant:"bodySmall",color:F?"error":"muted",className:o.helper,children:V})]})});exports.Select=il;
2
- //# sourceMappingURL=Select-CVy5BnKe.cjs.map
1
+ "use strict";const s=require("react/jsx-runtime"),n=require("react"),M=require("clsx"),Te=require("./formContext-bTWrqdEV.cjs"),De=require("./FloatingPanel-U6sGYiSK.cjs"),Le=require("./names-BJnFU_5m.cjs"),T=require("./Icon-BVULqOJD.cjs"),Ce=require("./List-ChXO0Hz-.cjs"),Ee=require("./ListItem-yXXjtepZ.cjs"),Se=require("./Loader-B5YqzEYy.cjs"),O=require("./Typography-BFatE1_A.cjs"),Re=require("./ConfigProvider-Bszl3Wr3.cjs"),Me="_field_17o9l_1",Oe="_fullWidth_17o9l_7",Pe="_label_17o9l_13",Ae="_required_17o9l_22",Be="_control_17o9l_28",Ke="_open_17o9l_47",We="_error_17o9l_52",Fe="_disabled_17o9l_60",Ve="_value_17o9l_70",$e="_valueIcon_17o9l_78",He="_valueLabel_17o9l_82",Qe="_placeholder_17o9l_87",ze="_clear_17o9l_92",Ue="_chevron_17o9l_111",Ge="_sm_17o9l_121",Je="_md_17o9l_125",Xe="_lg_17o9l_129",Ye="_helper_17o9l_134",Ze="_popover_17o9l_139",el="_search_17o9l_147",ll="_searchIcon_17o9l_156",sl="_searchInput_17o9l_160",ol="_listbox_17o9l_176",rl="_active_17o9l_184",tl="_noOptions_17o9l_188",nl="_loading_17o9l_194",o={field:Me,fullWidth:Oe,label:Pe,required:Ae,control:Be,open:Ke,error:We,disabled:Fe,value:Ve,valueIcon:$e,valueLabel:He,placeholder:Qe,clear:ze,chevron:Ue,sm:Ge,md:Je,lg:Xe,helper:Ye,popover:Ze,search:el,searchIcon:ll,searchInput:sl,listbox:ol,active:rl,noOptions:tl,loading:nl},al=new Set(Le.ICON_NAMES);function cl(m,h){return m==null?null:typeof m=="string"&&al.has(m)?s.jsx(T.Icon,{name:m,size:h}):m}const il=n.forwardRef(function({label:h,options:D,size:y="md",error:te,helperText:ne,required:Q=!1,fullWidth:ae=!0,disabled:p=!1,value:P,defaultValue:ce,onChange:A,placeholder:ie,clearable:ue=!0,searchable:u=!1,searchPlaceholder:de,onSearchChange:g,loading:fe=!1,loadingText:pe,noOptionsText:L,showSelectedTick:_e=!0,name:v,id:me,className:he,style:ve},j){const be=n.useId(),w=me??be,B=`${w}-label`,K=`${w}-listbox`,z=`${w}-helper`,W=e=>`${w}-opt-${e}`,N=Re.useT(),U=de??N("common.search"),C=Te.useFormContext(),E=!!(C&&v),c=E?C.field(v):void 0,xe=P!==void 0?P:E?C.values[v]??"":void 0,G=P!==void 0||E,[Ie,ye]=n.useState(ce??""),S=G?xe:Ie,F=te??(c==null?void 0:c.error)??!1,V=ne??(c==null?void 0:c.helperText),_=D.find(e=>e.value===S),ge=_!=null,J=e=>{G||ye(e),E&&C.setValue(v,e),A==null||A(e)},b=n.useRef(null),X=n.useRef(null),$=n.useRef({buffer:"",timer:0}),R=n.useRef(void 0);R.current=c?()=>c.onBlur({}):void 0;const[r,Y]=n.useState(!1),[x,Z]=n.useState(""),[d,i]=n.useState(-1),je=n.useCallback(e=>{b.current=e,typeof j=="function"?j(e):j&&(j.current=e)},[j]),a=n.useMemo(()=>{if(!u||g||!x.trim())return D;const e=x.trim().toLowerCase();return D.filter(l=>l.label.toLowerCase().includes(e))},[u,g,x,D]),I=n.useCallback((e,l)=>{let t=e;for(;t>=0&&t<a.length;){if(!a[t].disabled)return t;t+=l}return-1},[a]),ee=n.useRef(null),k=n.useCallback(e=>{var l,t;Y(!1),Z(""),window.clearTimeout($.current.timer),$.current.buffer="",(l=R.current)==null||l.call(R),e&&((t=b.current)==null||t.focus())},[]);n.useEffect(()=>{if(!r)return;const e=a.findIndex(l=>l.value===S);i(e>=0&&!a[e].disabled?e:I(0,1)),u&&requestAnimationFrame(()=>{var l;return(l=X.current)==null?void 0:l.focus()})},[r]),n.useEffect(()=>{var e,l;!r||d<0||(l=(e=document.getElementById(W(d)))==null?void 0:e.scrollIntoView)==null||l.call(e,{block:"nearest"})},[r,d]),n.useEffect(()=>{r&&u&&i(I(0,1))},[x]),n.useEffect(()=>{r&&i(e=>e<a.length?e:I(0,1))},[a.length]);const q=()=>{p||Y(!0)},H=e=>{!e||e.disabled||(J(e.value),k(!0))},le=e=>{i(l=>{const t=l<0?e>0?0:a.length-1:l+e,f=I(t,e);return f===-1?l:f})},we=e=>{const l=$.current;window.clearTimeout(l.timer),l.buffer+=e.toLowerCase(),l.timer=window.setTimeout(()=>l.buffer="",500);const t=a.findIndex(f=>!f.disabled&&f.label.toLowerCase().startsWith(l.buffer));t>=0&&i(t)},se=e=>{if(!p)switch(e.key){case"ArrowDown":e.preventDefault(),r?le(1):q();break;case"ArrowUp":e.preventDefault(),r?le(-1):q();break;case"Enter":e.preventDefault(),r?H(a[d]):q();break;case" ":r?u||(e.preventDefault(),H(a[d])):(e.preventDefault(),q());break;case"Escape":r&&(e.preventDefault(),e.stopPropagation(),k(!0));break;case"Tab":r&&k(!0);break;case"Home":r&&(e.preventDefault(),i(I(0,1)));break;case"End":r&&(e.preventDefault(),i(I(a.length-1,-1)));break;default:!u&&r&&e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&we(e.key)}},Ne=e=>{var t,f;const l=e.relatedTarget;l&&((t=ee.current)!=null&&t.contains(l)||(f=b.current)!=null&&f.contains(l))||c==null||c.onBlur(e)},ke=e=>{var l;e.stopPropagation(),J(""),(l=b.current)==null||l.focus()},oe=r&&d>=0?W(d):void 0,qe=y==="sm"?"sm":"md",re=y==="sm"?16:y==="md"?14:12;return s.jsxs("div",{className:M.clsx(o.field,o[y],ae&&o.fullWidth,F&&o.error,p&&o.disabled,he),style:ve,children:[h!=null&&s.jsxs("span",{id:B,className:o.label,onClick:()=>{var e;return!p&&((e=b.current)==null?void 0:e.focus())},children:[s.jsx(O.Typography,{as:"span",variant:"bodySmall",color:"muted",children:h}),Q&&s.jsx("span",{className:o.required,"aria-hidden":"true",children:"*"})]}),s.jsxs("div",{ref:je,id:w,...v?{name:v}:{},role:"combobox",tabIndex:p?-1:0,"aria-haspopup":"listbox","aria-expanded":r,"aria-controls":r?K:void 0,"aria-activedescendant":u?void 0:oe,"aria-labelledby":h!=null?B:void 0,"aria-disabled":p||void 0,"aria-required":Q||void 0,"aria-invalid":F||void 0,"aria-describedby":V!=null?z:void 0,className:M.clsx(o.control,r&&o.open),onClick:()=>r?k(!1):q(),onKeyDown:se,onBlur:Ne,children:[s.jsxs("span",{className:M.clsx(o.value,!ge&&o.placeholder),children:[(_==null?void 0:_.icon)!=null&&s.jsx("span",{className:o.valueIcon,children:cl(_.icon,qe)}),s.jsx("span",{className:o.valueLabel,children:_?_.label:ie??N("select.placeholder")})]}),ue&&S!==""&&!p&&s.jsx("button",{type:"button",className:o.clear,"aria-label":N("select.clear"),tabIndex:-1,onMouseDown:e=>e.preventDefault(),onClick:ke,children:s.jsx(T.Icon,{name:"CloseCircle",size:"sm"})}),s.jsx(T.Icon,{name:"ArrowDown4",className:o.chevron,style:{width:re,height:re},"aria-hidden":"true"})]}),s.jsxs(De.FloatingPanel,{ref:ee,open:r,triggerRef:b,onClose:k,matchTriggerWidth:!0,className:o.popover,children:[u&&s.jsxs("div",{className:o.search,children:[s.jsx(T.Icon,{name:"SearchNormal",size:"sm",className:o.searchIcon,"aria-hidden":"true"}),s.jsx("input",{ref:X,className:o.searchInput,type:"text",role:"combobox","aria-expanded":"true","aria-controls":K,"aria-activedescendant":oe,"aria-autocomplete":"list","aria-label":U,placeholder:U,value:x,spellCheck:!1,onChange:e=>{Z(e.target.value),g==null||g(e.target.value)},onKeyDown:se})]}),s.jsx(Ce.List,{role:"listbox",id:K,"aria-labelledby":h!=null?B:void 0,size:y,className:o.listbox,onMouseLeave:()=>i(-1),children:fe?s.jsxs("div",{className:o.loading,children:[s.jsx(Se.Loader,{size:"sm"}),s.jsx(O.Typography,{as:"span",variant:"bodySmall",color:"muted",children:pe??N("common.loading")})]}):a.length===0?s.jsx("div",{className:o.noOptions,children:s.jsx(O.Typography,{as:"span",variant:"bodySmall",color:"muted",children:L==null?N("select.noOptions"):typeof L=="function"?L(x):L})}):a.map((e,l)=>{const t=e.value===S;return s.jsx(Ee.ListItem,{id:W(l),role:"option",tabIndex:-1,"aria-selected":t,"aria-current":void 0,clickable:!0,selected:t,disabled:e.disabled,icon:e.icon,className:M.clsx(l===d&&o.active),trailing:t&&_e?s.jsx(T.Icon,{name:"TickCircle",size:"sm"}):void 0,onMouseEnter:()=>!e.disabled&&i(l),onClick:()=>H(e),children:e.label},e.value)})})]}),V!=null&&s.jsx(O.Typography,{as:"span",id:z,variant:"bodySmall",color:F?"error":"muted",className:o.helper,children:V})]})});exports.Select=il;
2
+ //# sourceMappingURL=Select-7vEGJCvA.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select-CVy5BnKe.cjs","sources":["../src/components/Select/Select.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { useFormContext } from '../../form/formContext'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { List, ListItem } from '../List'\nimport { Loader } from '../Loader'\nimport { Typography } from '../Typography'\nimport styles from './Select.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type SelectSize = 'sm' | 'md' | 'lg'\n\n/** A single selectable option. */\nexport interface SelectOption {\n /** The value committed when this option is chosen. */\n value: string\n /** Display + search text. */\n label: string\n /** Greys out and blocks selecting this option. */\n disabled?: boolean\n /** Leading icon — a known `IconName` (rendered as `<Icon>`) or any node. */\n icon?: IconName | ReactNode\n}\n\n/** Renders an option's icon (an `IconName` becomes an `<Icon>`; anything else is used as-is). */\nfunction renderIcon(icon: IconName | ReactNode, size: 'sm' | 'md'): ReactNode {\n if (icon == null) return null\n if (typeof icon === 'string' && ICON_NAME_SET.has(icon))\n return <Icon name={icon as IconName} size={size} />\n return icon\n}\n\nexport interface SelectProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** The selectable options. */\n options: SelectOption[]\n /** Preset size — control height, font and option density. */\n size?: SelectSize\n /** Marks the field invalid: red border/ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Disables the field. */\n disabled?: boolean\n /** Controlled value — the chosen option's `value` (`''` = nothing selected). */\n value?: string\n /** Initial value for uncontrolled use. */\n defaultValue?: string\n /** Fires with the next value (`''` when cleared). */\n onChange?: (value: string) => void\n /** Text shown in the trigger when nothing is selected. Defaults to `\"Select…\"`. */\n placeholder?: string\n /** Shows a clear (×) button in the trigger when a value is set. Defaults to `true`. */\n clearable?: boolean\n /** Adds a search box inside the popover that filters options by label. */\n searchable?: boolean\n /** Placeholder for the search box. Defaults to `\"Search…\"`. */\n searchPlaceholder?: string\n /**\n * Fires with the search query as the user types. **Providing this switches off the built-in\n * local filtering** — you own `options` (e.g. fetch them from a server for the current query).\n */\n onSearchChange?: (query: string) => void\n /** Shows a loading indicator in the popover (e.g. while fetching server-side search results). */\n loading?: boolean\n /** Text shown next to the loader while `loading`. Defaults to `\"Loading…\"`. */\n loadingText?: ReactNode\n /**\n * Shown in the popover when no option matches. Defaults to `\"No options\"`. Pass a function\n * `(query) => node` to vary the message by the current search text — e.g. a \"Type to search\" hint\n * while it's empty vs a \"No results\" message after typing.\n */\n noOptionsText?: ReactNode | ((query: string) => ReactNode)\n /** Show the trailing tick on the selected option. Defaults to `true` (the row still gets its tint). */\n showSelectedTick?: boolean\n /** Form field name — auto-binds to a surrounding `<Form>` (value is the option's `value`). */\n name?: string\n /** Id for the trigger (label association). */\n id?: string\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A labeled single-select. The trigger reuses TextField-style chrome (label, helper/error, sizes,\n * `required`, `fullWidth`, `disabled`); clicking it opens a `Dropdown`-style popover — portaled to\n * `<body>`, opening below (flipping above only when it would overflow), locking page scroll,\n * re-positioning on scroll/resize, matching the trigger width, and entering with the shared\n * opacity + translate animation. Options render as `ListItem`s in a `role=\"listbox\"`; the chosen\n * option is highlighted with a tick, disabled options are inert. Full keyboard support\n * (Arrow/Home/End to move, Enter/Space to select, Escape to close, type-ahead) and ARIA\n * (`listbox`/`option`, `aria-activedescendant`, `aria-expanded`). Optionally `searchable` (a filter\n * box) and `clearable` (a × to reset); pass `onSearchChange` to drive the search **server-side** (the\n * consumer owns `options` for the current query — local filtering is skipped) with a `loading`\n * indicator. Controlled (`value` + `onChange`) or uncontrolled\n * (`defaultValue`), and binds to a surrounding `<Form>` by `name` (value = the option's `value`;\n * validate with e.g. `z.string().min(1, 'Required')`). Token-only styling.\n */\nexport const Select = forwardRef<HTMLDivElement, SelectProps>(function Select(\n {\n label,\n options,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n disabled = false,\n value,\n defaultValue,\n onChange,\n placeholder,\n clearable = true,\n searchable = false,\n searchPlaceholder,\n onSearchChange,\n loading = false,\n loadingText,\n noOptionsText,\n showSelectedTick = true,\n name,\n id: idProp,\n className,\n style,\n },\n ref,\n) {\n const reactId = useId()\n const id = idProp ?? reactId\n const labelId = `${id}-label`\n const listboxId = `${id}-listbox`\n const helperId = `${id}-helper`\n const optionId = (index: number) => `${id}-opt-${index}`\n\n const t = useT()\n const searchPh = searchPlaceholder ?? t('common.search')\n\n // ── value (controlled / form-bound / uncontrolled) ─────────────────────────────────────────────\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = isFormBound ? form!.field(name!) : undefined\n const externalValue =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | undefined) ?? '')\n : undefined\n const isControlled = value !== undefined || isFormBound\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentValue = isControlled ? externalValue! : internal\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const selected = options.find((o) => o.value === currentValue)\n const hasValue = selected != null\n\n const commit = (next: string) => {\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n // ── popover open state ─────────────────────────────────────────────────────────────────────────\n const triggerRef = useRef<HTMLDivElement | null>(null)\n const searchInputRef = useRef<HTMLInputElement | null>(null)\n const typeahead = useRef({ buffer: '', timer: 0 })\n // stable handle to the form field's blur (touched) callback — field() returns a fresh object each render\n const fieldBlur = useRef<(() => void) | undefined>(undefined)\n fieldBlur.current = bound ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>) : undefined\n const [open, setOpen] = useState(false)\n const [searchQuery, setSearchQuery] = useState('')\n const [highlightedIndex, setHighlightedIndex] = useState(-1)\n\n const setTriggerRef = useCallback(\n (node: HTMLDivElement | null) => {\n triggerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLDivElement | null }).current = node\n },\n [ref],\n )\n\n // options shown right now. When `onSearchChange` is set the consumer owns `options` (server-side\n // search) — skip the built-in local filter; otherwise filter the given options by label.\n const filteredOptions = useMemo(() => {\n if (!searchable || onSearchChange || !searchQuery.trim()) return options\n const q = searchQuery.trim().toLowerCase()\n return options.filter((o) => o.label.toLowerCase().includes(q))\n }, [searchable, onSearchChange, searchQuery, options])\n\n const findEnabled = useCallback(\n (start: number, delta: number) => {\n let i = start\n while (i >= 0 && i < filteredOptions.length) {\n if (!filteredOptions[i].disabled) return i\n i += delta\n }\n return -1\n },\n [filteredOptions],\n )\n\n // the floating panel forwards its node here, for the focus-leaves-the-widget check on blur\n const popoverRef = useRef<HTMLDivElement | null>(null)\n\n // single dismiss path: clears search + type-ahead buffer, marks the field touched, optionally refocuses\n const closeMenu = useCallback((refocus: boolean) => {\n setOpen(false)\n setSearchQuery('')\n window.clearTimeout(typeahead.current.timer)\n typeahead.current.buffer = ''\n fieldBlur.current?.()\n if (refocus) triggerRef.current?.focus()\n }, [])\n\n // on open: highlight the selected option (or first enabled), focus the search box if searchable\n useEffect(() => {\n if (!open) return\n const selIdx = filteredOptions.findIndex((o) => o.value === currentValue)\n setHighlightedIndex(\n selIdx >= 0 && !filteredOptions[selIdx].disabled ? selIdx : findEnabled(0, 1),\n )\n if (searchable) requestAnimationFrame(() => searchInputRef.current?.focus())\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n // keep the highlighted option scrolled into view\n useEffect(() => {\n if (!open || highlightedIndex < 0) return\n document.getElementById(optionId(highlightedIndex))?.scrollIntoView?.({ block: 'nearest' })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, highlightedIndex])\n\n // when the search filter changes, re-anchor the highlight to the first match\n useEffect(() => {\n if (open && searchable) setHighlightedIndex(findEnabled(0, 1))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchQuery])\n\n // if the option count changes while open (async load / list shrink), keep the highlight in range\n useEffect(() => {\n if (open) setHighlightedIndex((i) => (i < filteredOptions.length ? i : findEnabled(0, 1)))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [filteredOptions.length])\n\n const openMenu = () => {\n if (!disabled) setOpen(true)\n }\n const selectOption = (opt: SelectOption | undefined) => {\n if (!opt || opt.disabled) return\n commit(opt.value)\n closeMenu(true)\n }\n const moveHighlight = (delta: number) => {\n setHighlightedIndex((cur) => {\n const start = cur < 0 ? (delta > 0 ? 0 : filteredOptions.length - 1) : cur + delta\n const found = findEnabled(start, delta)\n return found === -1 ? cur : found\n })\n }\n\n // type-ahead (non-searchable): jump to the option whose label starts with the typed buffer\n const handleTypeahead = (char: string) => {\n const t = typeahead.current\n window.clearTimeout(t.timer)\n t.buffer += char.toLowerCase()\n t.timer = window.setTimeout(() => (t.buffer = ''), 500)\n const match = filteredOptions.findIndex(\n (o) => !o.disabled && o.label.toLowerCase().startsWith(t.buffer),\n )\n if (match >= 0) setHighlightedIndex(match)\n }\n\n const handleKeyDown = (event: ReactKeyboardEvent) => {\n if (disabled) return\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n open ? moveHighlight(1) : openMenu()\n break\n case 'ArrowUp':\n event.preventDefault()\n open ? moveHighlight(-1) : openMenu()\n break\n case 'Enter':\n event.preventDefault()\n if (!open) openMenu()\n else selectOption(filteredOptions[highlightedIndex])\n break\n case ' ':\n // Space opens a closed menu (any mode); selects only when open & not searchable\n // (so a focused search box can still type spaces)\n if (!open) {\n event.preventDefault()\n openMenu()\n } else if (!searchable) {\n event.preventDefault()\n selectOption(filteredOptions[highlightedIndex])\n }\n break\n case 'Escape':\n if (open) {\n event.preventDefault()\n event.stopPropagation() // don't let FloatingPanel's own Escape also fire closeMenu/onBlur\n closeMenu(true)\n }\n break\n case 'Tab':\n // refocus the trigger so Tab continues from the field's visual location, not the portaled\n // search input's DOM position (end of <body>); don't preventDefault — let Tab move on\n if (open) closeMenu(true)\n break\n case 'Home':\n if (open) {\n event.preventDefault()\n setHighlightedIndex(findEnabled(0, 1))\n }\n break\n case 'End':\n if (open) {\n event.preventDefault()\n setHighlightedIndex(findEnabled(filteredOptions.length - 1, -1))\n }\n break\n default:\n if (\n !searchable &&\n open &&\n event.key.length === 1 &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.altKey\n ) {\n handleTypeahead(event.key)\n }\n }\n }\n\n const handleTriggerBlur = (event: FocusEvent<HTMLDivElement>) => {\n // mark the form field touched only when focus leaves the whole widget (not into the popover)\n const next = event.relatedTarget as Node | null\n if (next && (popoverRef.current?.contains(next) || triggerRef.current?.contains(next))) return\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n\n const handleClear = (event: ReactMouseEvent) => {\n event.stopPropagation()\n commit('')\n triggerRef.current?.focus()\n }\n\n const activeId = open && highlightedIndex >= 0 ? optionId(highlightedIndex) : undefined\n const iconSize: 'sm' | 'md' = size === 'sm' ? 'sm' : 'md'\n // chevron size per field size: sm 16 · md 14 · lg 12\n const chevronPx = size === 'sm' ? 16 : size === 'md' ? 14 : 12\n\n return (\n <div\n className={clsx(\n styles.field,\n styles[size],\n fullWidth && styles.fullWidth,\n resolvedError && styles.error,\n disabled && styles.disabled,\n className,\n )}\n style={style}\n >\n {label != null && (\n <span\n id={labelId}\n className={styles.label}\n onClick={() => !disabled && triggerRef.current?.focus()}\n >\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n )}\n\n <div\n ref={setTriggerRef}\n id={id}\n // `name` lets the form's scroll-to-error find + focus this field\n {...(name ? { name } : {})}\n role=\"combobox\"\n tabIndex={disabled ? -1 : 0}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? listboxId : undefined}\n aria-activedescendant={searchable ? undefined : activeId}\n aria-labelledby={label != null ? labelId : undefined}\n aria-disabled={disabled || undefined}\n aria-required={required || undefined}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n className={clsx(styles.control, open && styles.open)}\n onClick={() => (open ? closeMenu(false) : openMenu())}\n onKeyDown={handleKeyDown}\n onBlur={handleTriggerBlur}\n >\n <span className={clsx(styles.value, !hasValue && styles.placeholder)}>\n {selected?.icon != null && (\n <span className={styles.valueIcon}>{renderIcon(selected.icon, iconSize)}</span>\n )}\n <span className={styles.valueLabel}>\n {selected ? selected.label : (placeholder ?? t('select.placeholder'))}\n </span>\n </span>\n\n {clearable && currentValue !== '' && !disabled && (\n <button\n type=\"button\"\n className={styles.clear}\n aria-label={t('select.clear')}\n tabIndex={-1}\n onMouseDown={(e) => e.preventDefault()}\n onClick={handleClear}\n >\n <Icon name=\"CloseCircle\" size=\"sm\" />\n </button>\n )}\n\n <Icon\n name=\"ArrowDown4\"\n className={styles.chevron}\n style={{ width: chevronPx, height: chevronPx }}\n aria-hidden=\"true\"\n />\n </div>\n\n <FloatingPanel\n ref={popoverRef}\n open={open}\n triggerRef={triggerRef}\n onClose={closeMenu}\n matchTriggerWidth\n className={styles.popover}\n >\n {searchable && (\n <div className={styles.search}>\n <Icon name=\"SearchNormal\" size=\"sm\" className={styles.searchIcon} aria-hidden=\"true\" />\n <input\n ref={searchInputRef}\n className={styles.searchInput}\n type=\"text\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-controls={listboxId}\n aria-activedescendant={activeId}\n aria-autocomplete=\"list\"\n aria-label={searchPh}\n placeholder={searchPh}\n value={searchQuery}\n spellCheck={false}\n onChange={(e) => {\n setSearchQuery(e.target.value)\n onSearchChange?.(e.target.value)\n }}\n onKeyDown={handleKeyDown}\n />\n </div>\n )}\n\n {/* the listbox always carries `listboxId` (even when empty) so aria-controls never dangles */}\n <List\n role=\"listbox\"\n id={listboxId}\n aria-labelledby={label != null ? labelId : undefined}\n size={size}\n className={styles.listbox}\n // clear the mouse highlight when the pointer leaves the list (no lingering hover)\n onMouseLeave={() => setHighlightedIndex(-1)}\n >\n {loading ? (\n <div className={styles.loading}>\n <Loader size=\"sm\" />\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {loadingText ?? t('common.loading')}\n </Typography>\n </div>\n ) : filteredOptions.length === 0 ? (\n <div className={styles.noOptions}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {noOptionsText == null\n ? t('select.noOptions')\n : typeof noOptionsText === 'function'\n ? noOptionsText(searchQuery)\n : noOptionsText}\n </Typography>\n </div>\n ) : (\n filteredOptions.map((opt, index) => {\n const isSelected = opt.value === currentValue\n return (\n <ListItem\n key={opt.value}\n id={optionId(index)}\n role=\"option\"\n tabIndex={-1}\n aria-selected={isSelected}\n aria-current={undefined}\n clickable\n selected={isSelected}\n disabled={opt.disabled}\n icon={opt.icon}\n className={clsx(index === highlightedIndex && styles.active)}\n trailing={\n isSelected && showSelectedTick ? (\n <Icon name=\"TickCircle\" size=\"sm\" />\n ) : undefined\n }\n onMouseEnter={() => !opt.disabled && setHighlightedIndex(index)}\n onClick={() => selectOption(opt)}\n >\n {opt.label}\n </ListItem>\n )\n })\n )}\n </List>\n </FloatingPanel>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={styles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["ICON_NAME_SET","ICON_NAMES","renderIcon","icon","size","jsx","Icon","Select","forwardRef","label","options","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","placeholder","clearable","searchable","searchPlaceholder","onSearchChange","loading","loadingText","noOptionsText","showSelectedTick","name","idProp","className","style","ref","reactId","useId","id","labelId","listboxId","helperId","optionId","index","t","useT","searchPh","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","resolvedError","resolvedHelperText","selected","o","hasValue","commit","next","triggerRef","useRef","searchInputRef","typeahead","fieldBlur","open","setOpen","searchQuery","setSearchQuery","highlightedIndex","setHighlightedIndex","setTriggerRef","useCallback","node","filteredOptions","useMemo","q","findEnabled","start","delta","i","popoverRef","closeMenu","refocus","_a","_b","useEffect","selIdx","openMenu","selectOption","opt","moveHighlight","cur","found","handleTypeahead","char","match","handleKeyDown","event","handleTriggerBlur","handleClear","activeId","iconSize","chevronPx","jsxs","clsx","styles","Typography","FloatingPanel","List","Loader","isSelected","ListItem"],"mappings":"+xCAyBMA,GAAgB,IAAI,IAAYC,aAAU,EAiBhD,SAASC,GAAWC,EAA4BC,EAA8B,CAC5E,OAAID,GAAQ,KAAa,KACrB,OAAOA,GAAS,UAAYH,GAAc,IAAIG,CAAI,EAC7CE,EAAAA,IAACC,EAAAA,KAAA,CAAK,KAAMH,EAAkB,KAAAC,CAAA,CAAY,EAC5CD,CACT,CAyEO,MAAMI,GAASC,EAAAA,WAAwC,SAC5D,CACE,MAAAC,EACA,QAAAC,EACA,KAAAN,EAAO,KACP,MAAAO,GACA,WAAAC,GACA,SAAAC,EAAW,GACX,UAAAC,GAAY,GACZ,SAAAC,EAAW,GACX,MAAAC,EACA,aAAAC,GACA,SAAAC,EACA,YAAAC,GACA,UAAAC,GAAY,GACZ,WAAAC,EAAa,GACb,kBAAAC,GACA,eAAAC,EACA,QAAAC,GAAU,GACV,YAAAC,GACA,cAAAC,EACA,iBAAAC,GAAmB,GACnB,KAAAC,EACA,GAAIC,GACJ,UAAAC,GACA,MAAAC,EACF,EACAC,EACA,CACA,MAAMC,GAAUC,EAAAA,MAAA,EACVC,EAAKN,IAAUI,GACfG,EAAU,GAAGD,CAAE,SACfE,EAAY,GAAGF,CAAE,WACjBG,EAAW,GAAGH,CAAE,UAChBI,EAAYC,GAAkB,GAAGL,CAAE,QAAQK,CAAK,GAEhDC,EAAIC,GAAAA,KAAA,EACJC,EAAWrB,IAAqBmB,EAAE,eAAe,EAGjDG,EAAO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EAAAA,IAACuG,EAAAA,WAAA,CACC,GAAG,OACH,GAAItE,EACJ,QAAQ,YACR,MAAOgB,EAAgB,QAAU,QACjC,UAAWqD,EAAO,OAEjB,SAAApD,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,CAAC"}
1
+ {"version":3,"file":"Select-7vEGJCvA.cjs","sources":["../src/components/Select/Select.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { useFormContext } from '../../form/formContext'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { List, ListItem } from '../List'\nimport { Loader } from '../Loader'\nimport { Typography } from '../Typography'\nimport styles from './Select.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type SelectSize = 'sm' | 'md' | 'lg'\n\n/** A single selectable option. */\nexport interface SelectOption {\n /** The value committed when this option is chosen. */\n value: string\n /** Display + search text. */\n label: string\n /** Greys out and blocks selecting this option. */\n disabled?: boolean\n /** Leading icon — a known `IconName` (rendered as `<Icon>`) or any node. */\n icon?: IconName | ReactNode\n}\n\n/** Renders an option's icon (an `IconName` becomes an `<Icon>`; anything else is used as-is). */\nfunction renderIcon(icon: IconName | ReactNode, size: 'sm' | 'md'): ReactNode {\n if (icon == null) return null\n if (typeof icon === 'string' && ICON_NAME_SET.has(icon))\n return <Icon name={icon as IconName} size={size} />\n return icon\n}\n\nexport interface SelectProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** The selectable options. */\n options: SelectOption[]\n /** Preset size — control height, font and option density. */\n size?: SelectSize\n /** Marks the field invalid: red border/ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Disables the field. */\n disabled?: boolean\n /** Controlled value — the chosen option's `value` (`''` = nothing selected). */\n value?: string\n /** Initial value for uncontrolled use. */\n defaultValue?: string\n /** Fires with the next value (`''` when cleared). */\n onChange?: (value: string) => void\n /** Text shown in the trigger when nothing is selected. Defaults to `\"Select…\"`. */\n placeholder?: string\n /** Shows a clear (×) button in the trigger when a value is set. Defaults to `true`. */\n clearable?: boolean\n /** Adds a search box inside the popover that filters options by label. */\n searchable?: boolean\n /** Placeholder for the search box. Defaults to `\"Search…\"`. */\n searchPlaceholder?: string\n /**\n * Fires with the search query as the user types. **Providing this switches off the built-in\n * local filtering** — you own `options` (e.g. fetch them from a server for the current query).\n */\n onSearchChange?: (query: string) => void\n /** Shows a loading indicator in the popover (e.g. while fetching server-side search results). */\n loading?: boolean\n /** Text shown next to the loader while `loading`. Defaults to `\"Loading…\"`. */\n loadingText?: ReactNode\n /**\n * Shown in the popover when no option matches. Defaults to `\"No options\"`. Pass a function\n * `(query) => node` to vary the message by the current search text — e.g. a \"Type to search\" hint\n * while it's empty vs a \"No results\" message after typing.\n */\n noOptionsText?: ReactNode | ((query: string) => ReactNode)\n /** Show the trailing tick on the selected option. Defaults to `true` (the row still gets its tint). */\n showSelectedTick?: boolean\n /** Form field name — auto-binds to a surrounding `<Form>` (value is the option's `value`). */\n name?: string\n /** Id for the trigger (label association). */\n id?: string\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A labeled single-select. The trigger reuses TextField-style chrome (label, helper/error, sizes,\n * `required`, `fullWidth`, `disabled`); clicking it opens a `Dropdown`-style popover — portaled to\n * `<body>`, opening below (flipping above only when it would overflow), locking page scroll,\n * re-positioning on scroll/resize, matching the trigger width, and entering with the shared\n * opacity + translate animation. Options render as `ListItem`s in a `role=\"listbox\"`; the chosen\n * option is highlighted with a tick, disabled options are inert. Full keyboard support\n * (Arrow/Home/End to move, Enter/Space to select, Escape to close, type-ahead) and ARIA\n * (`listbox`/`option`, `aria-activedescendant`, `aria-expanded`). Optionally `searchable` (a filter\n * box) and `clearable` (a × to reset); pass `onSearchChange` to drive the search **server-side** (the\n * consumer owns `options` for the current query — local filtering is skipped) with a `loading`\n * indicator. Controlled (`value` + `onChange`) or uncontrolled\n * (`defaultValue`), and binds to a surrounding `<Form>` by `name` (value = the option's `value`;\n * validate with e.g. `z.string().min(1, 'Required')`). Token-only styling.\n */\nexport const Select = forwardRef<HTMLDivElement, SelectProps>(function Select(\n {\n label,\n options,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n disabled = false,\n value,\n defaultValue,\n onChange,\n placeholder,\n clearable = true,\n searchable = false,\n searchPlaceholder,\n onSearchChange,\n loading = false,\n loadingText,\n noOptionsText,\n showSelectedTick = true,\n name,\n id: idProp,\n className,\n style,\n },\n ref,\n) {\n const reactId = useId()\n const id = idProp ?? reactId\n const labelId = `${id}-label`\n const listboxId = `${id}-listbox`\n const helperId = `${id}-helper`\n const optionId = (index: number) => `${id}-opt-${index}`\n\n const t = useT()\n const searchPh = searchPlaceholder ?? t('common.search')\n\n // ── value (controlled / form-bound / uncontrolled) ─────────────────────────────────────────────\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = isFormBound ? form!.field(name!) : undefined\n const externalValue =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | undefined) ?? '')\n : undefined\n const isControlled = value !== undefined || isFormBound\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentValue = isControlled ? externalValue! : internal\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const selected = options.find((o) => o.value === currentValue)\n const hasValue = selected != null\n\n const commit = (next: string) => {\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n // ── popover open state ─────────────────────────────────────────────────────────────────────────\n const triggerRef = useRef<HTMLDivElement | null>(null)\n const searchInputRef = useRef<HTMLInputElement | null>(null)\n const typeahead = useRef({ buffer: '', timer: 0 })\n // stable handle to the form field's blur (touched) callback — field() returns a fresh object each render\n const fieldBlur = useRef<(() => void) | undefined>(undefined)\n fieldBlur.current = bound ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>) : undefined\n const [open, setOpen] = useState(false)\n const [searchQuery, setSearchQuery] = useState('')\n const [highlightedIndex, setHighlightedIndex] = useState(-1)\n\n const setTriggerRef = useCallback(\n (node: HTMLDivElement | null) => {\n triggerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLDivElement | null }).current = node\n },\n [ref],\n )\n\n // options shown right now. When `onSearchChange` is set the consumer owns `options` (server-side\n // search) — skip the built-in local filter; otherwise filter the given options by label.\n const filteredOptions = useMemo(() => {\n if (!searchable || onSearchChange || !searchQuery.trim()) return options\n const q = searchQuery.trim().toLowerCase()\n return options.filter((o) => o.label.toLowerCase().includes(q))\n }, [searchable, onSearchChange, searchQuery, options])\n\n const findEnabled = useCallback(\n (start: number, delta: number) => {\n let i = start\n while (i >= 0 && i < filteredOptions.length) {\n if (!filteredOptions[i].disabled) return i\n i += delta\n }\n return -1\n },\n [filteredOptions],\n )\n\n // the floating panel forwards its node here, for the focus-leaves-the-widget check on blur\n const popoverRef = useRef<HTMLDivElement | null>(null)\n\n // single dismiss path: clears search + type-ahead buffer, marks the field touched, optionally refocuses\n const closeMenu = useCallback((refocus: boolean) => {\n setOpen(false)\n setSearchQuery('')\n window.clearTimeout(typeahead.current.timer)\n typeahead.current.buffer = ''\n fieldBlur.current?.()\n if (refocus) triggerRef.current?.focus()\n }, [])\n\n // on open: highlight the selected option (or first enabled), focus the search box if searchable\n useEffect(() => {\n if (!open) return\n const selIdx = filteredOptions.findIndex((o) => o.value === currentValue)\n setHighlightedIndex(\n selIdx >= 0 && !filteredOptions[selIdx].disabled ? selIdx : findEnabled(0, 1),\n )\n if (searchable) requestAnimationFrame(() => searchInputRef.current?.focus())\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n // keep the highlighted option scrolled into view\n useEffect(() => {\n if (!open || highlightedIndex < 0) return\n document.getElementById(optionId(highlightedIndex))?.scrollIntoView?.({ block: 'nearest' })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, highlightedIndex])\n\n // when the search filter changes, re-anchor the highlight to the first match\n useEffect(() => {\n if (open && searchable) setHighlightedIndex(findEnabled(0, 1))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchQuery])\n\n // if the option count changes while open (async load / list shrink), keep the highlight in range\n useEffect(() => {\n if (open) setHighlightedIndex((i) => (i < filteredOptions.length ? i : findEnabled(0, 1)))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [filteredOptions.length])\n\n const openMenu = () => {\n if (!disabled) setOpen(true)\n }\n const selectOption = (opt: SelectOption | undefined) => {\n if (!opt || opt.disabled) return\n commit(opt.value)\n closeMenu(true)\n }\n const moveHighlight = (delta: number) => {\n setHighlightedIndex((cur) => {\n const start = cur < 0 ? (delta > 0 ? 0 : filteredOptions.length - 1) : cur + delta\n const found = findEnabled(start, delta)\n return found === -1 ? cur : found\n })\n }\n\n // type-ahead (non-searchable): jump to the option whose label starts with the typed buffer\n const handleTypeahead = (char: string) => {\n const t = typeahead.current\n window.clearTimeout(t.timer)\n t.buffer += char.toLowerCase()\n t.timer = window.setTimeout(() => (t.buffer = ''), 500)\n const match = filteredOptions.findIndex(\n (o) => !o.disabled && o.label.toLowerCase().startsWith(t.buffer),\n )\n if (match >= 0) setHighlightedIndex(match)\n }\n\n const handleKeyDown = (event: ReactKeyboardEvent) => {\n if (disabled) return\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n open ? moveHighlight(1) : openMenu()\n break\n case 'ArrowUp':\n event.preventDefault()\n open ? moveHighlight(-1) : openMenu()\n break\n case 'Enter':\n event.preventDefault()\n if (!open) openMenu()\n else selectOption(filteredOptions[highlightedIndex])\n break\n case ' ':\n // Space opens a closed menu (any mode); selects only when open & not searchable\n // (so a focused search box can still type spaces)\n if (!open) {\n event.preventDefault()\n openMenu()\n } else if (!searchable) {\n event.preventDefault()\n selectOption(filteredOptions[highlightedIndex])\n }\n break\n case 'Escape':\n if (open) {\n event.preventDefault()\n event.stopPropagation() // don't let FloatingPanel's own Escape also fire closeMenu/onBlur\n closeMenu(true)\n }\n break\n case 'Tab':\n // refocus the trigger so Tab continues from the field's visual location, not the portaled\n // search input's DOM position (end of <body>); don't preventDefault — let Tab move on\n if (open) closeMenu(true)\n break\n case 'Home':\n if (open) {\n event.preventDefault()\n setHighlightedIndex(findEnabled(0, 1))\n }\n break\n case 'End':\n if (open) {\n event.preventDefault()\n setHighlightedIndex(findEnabled(filteredOptions.length - 1, -1))\n }\n break\n default:\n if (\n !searchable &&\n open &&\n event.key.length === 1 &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.altKey\n ) {\n handleTypeahead(event.key)\n }\n }\n }\n\n const handleTriggerBlur = (event: FocusEvent<HTMLDivElement>) => {\n // mark the form field touched only when focus leaves the whole widget (not into the popover)\n const next = event.relatedTarget as Node | null\n if (next && (popoverRef.current?.contains(next) || triggerRef.current?.contains(next))) return\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n\n const handleClear = (event: ReactMouseEvent) => {\n event.stopPropagation()\n commit('')\n triggerRef.current?.focus()\n }\n\n const activeId = open && highlightedIndex >= 0 ? optionId(highlightedIndex) : undefined\n const iconSize: 'sm' | 'md' = size === 'sm' ? 'sm' : 'md'\n // chevron size per field size: sm 16 · md 14 · lg 12\n const chevronPx = size === 'sm' ? 16 : size === 'md' ? 14 : 12\n\n return (\n <div\n className={clsx(\n styles.field,\n styles[size],\n fullWidth && styles.fullWidth,\n resolvedError && styles.error,\n disabled && styles.disabled,\n className,\n )}\n style={style}\n >\n {label != null && (\n <span\n id={labelId}\n className={styles.label}\n onClick={() => !disabled && triggerRef.current?.focus()}\n >\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n )}\n\n <div\n ref={setTriggerRef}\n id={id}\n // `name` lets the form's scroll-to-error find + focus this field\n {...(name ? { name } : {})}\n role=\"combobox\"\n tabIndex={disabled ? -1 : 0}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? listboxId : undefined}\n aria-activedescendant={searchable ? undefined : activeId}\n aria-labelledby={label != null ? labelId : undefined}\n aria-disabled={disabled || undefined}\n aria-required={required || undefined}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n className={clsx(styles.control, open && styles.open)}\n onClick={() => (open ? closeMenu(false) : openMenu())}\n onKeyDown={handleKeyDown}\n onBlur={handleTriggerBlur}\n >\n <span className={clsx(styles.value, !hasValue && styles.placeholder)}>\n {selected?.icon != null && (\n <span className={styles.valueIcon}>{renderIcon(selected.icon, iconSize)}</span>\n )}\n <span className={styles.valueLabel}>\n {selected ? selected.label : (placeholder ?? t('select.placeholder'))}\n </span>\n </span>\n\n {clearable && currentValue !== '' && !disabled && (\n <button\n type=\"button\"\n className={styles.clear}\n aria-label={t('select.clear')}\n tabIndex={-1}\n onMouseDown={(e) => e.preventDefault()}\n onClick={handleClear}\n >\n <Icon name=\"CloseCircle\" size=\"sm\" />\n </button>\n )}\n\n <Icon\n name=\"ArrowDown4\"\n className={styles.chevron}\n style={{ width: chevronPx, height: chevronPx }}\n aria-hidden=\"true\"\n />\n </div>\n\n <FloatingPanel\n ref={popoverRef}\n open={open}\n triggerRef={triggerRef}\n onClose={closeMenu}\n matchTriggerWidth\n className={styles.popover}\n >\n {searchable && (\n <div className={styles.search}>\n <Icon name=\"SearchNormal\" size=\"sm\" className={styles.searchIcon} aria-hidden=\"true\" />\n <input\n ref={searchInputRef}\n className={styles.searchInput}\n type=\"text\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-controls={listboxId}\n aria-activedescendant={activeId}\n aria-autocomplete=\"list\"\n aria-label={searchPh}\n placeholder={searchPh}\n value={searchQuery}\n spellCheck={false}\n onChange={(e) => {\n setSearchQuery(e.target.value)\n onSearchChange?.(e.target.value)\n }}\n onKeyDown={handleKeyDown}\n />\n </div>\n )}\n\n {/* the listbox always carries `listboxId` (even when empty) so aria-controls never dangles */}\n <List\n role=\"listbox\"\n id={listboxId}\n aria-labelledby={label != null ? labelId : undefined}\n size={size}\n className={styles.listbox}\n // clear the mouse highlight when the pointer leaves the list (no lingering hover)\n onMouseLeave={() => setHighlightedIndex(-1)}\n >\n {loading ? (\n <div className={styles.loading}>\n <Loader size=\"sm\" />\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {loadingText ?? t('common.loading')}\n </Typography>\n </div>\n ) : filteredOptions.length === 0 ? (\n <div className={styles.noOptions}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {noOptionsText == null\n ? t('select.noOptions')\n : typeof noOptionsText === 'function'\n ? noOptionsText(searchQuery)\n : noOptionsText}\n </Typography>\n </div>\n ) : (\n filteredOptions.map((opt, index) => {\n const isSelected = opt.value === currentValue\n return (\n <ListItem\n key={opt.value}\n id={optionId(index)}\n role=\"option\"\n tabIndex={-1}\n aria-selected={isSelected}\n aria-current={undefined}\n clickable\n selected={isSelected}\n disabled={opt.disabled}\n icon={opt.icon}\n className={clsx(index === highlightedIndex && styles.active)}\n trailing={\n isSelected && showSelectedTick ? (\n <Icon name=\"TickCircle\" size=\"sm\" />\n ) : undefined\n }\n onMouseEnter={() => !opt.disabled && setHighlightedIndex(index)}\n onClick={() => selectOption(opt)}\n >\n {opt.label}\n </ListItem>\n )\n })\n )}\n </List>\n </FloatingPanel>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={styles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["ICON_NAME_SET","ICON_NAMES","renderIcon","icon","size","jsx","Icon","Select","forwardRef","label","options","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","placeholder","clearable","searchable","searchPlaceholder","onSearchChange","loading","loadingText","noOptionsText","showSelectedTick","name","idProp","className","style","ref","reactId","useId","id","labelId","listboxId","helperId","optionId","index","t","useT","searchPh","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","resolvedError","resolvedHelperText","selected","o","hasValue","commit","next","triggerRef","useRef","searchInputRef","typeahead","fieldBlur","open","setOpen","searchQuery","setSearchQuery","highlightedIndex","setHighlightedIndex","setTriggerRef","useCallback","node","filteredOptions","useMemo","q","findEnabled","start","delta","i","popoverRef","closeMenu","refocus","_a","_b","useEffect","selIdx","openMenu","selectOption","opt","moveHighlight","cur","found","handleTypeahead","char","match","handleKeyDown","event","handleTriggerBlur","handleClear","activeId","iconSize","chevronPx","jsxs","clsx","styles","Typography","FloatingPanel","List","Loader","isSelected","ListItem"],"mappings":"+xCAyBMA,GAAgB,IAAI,IAAYC,aAAU,EAiBhD,SAASC,GAAWC,EAA4BC,EAA8B,CAC5E,OAAID,GAAQ,KAAa,KACrB,OAAOA,GAAS,UAAYH,GAAc,IAAIG,CAAI,EAC7CE,EAAAA,IAACC,EAAAA,KAAA,CAAK,KAAMH,EAAkB,KAAAC,CAAA,CAAY,EAC5CD,CACT,CAyEO,MAAMI,GAASC,EAAAA,WAAwC,SAC5D,CACE,MAAAC,EACA,QAAAC,EACA,KAAAN,EAAO,KACP,MAAAO,GACA,WAAAC,GACA,SAAAC,EAAW,GACX,UAAAC,GAAY,GACZ,SAAAC,EAAW,GACX,MAAAC,EACA,aAAAC,GACA,SAAAC,EACA,YAAAC,GACA,UAAAC,GAAY,GACZ,WAAAC,EAAa,GACb,kBAAAC,GACA,eAAAC,EACA,QAAAC,GAAU,GACV,YAAAC,GACA,cAAAC,EACA,iBAAAC,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lE,IAAU8B,GAAoBqC,EAAO,MAAM,EAC3D,SACEK,GAAcrF,GACZtB,EAAAA,IAACC,EAAAA,MAAK,KAAK,aAAa,KAAK,IAAA,CAAK,EAChC,OAEN,aAAc,IAAM,CAACqF,EAAI,UAAYpB,EAAoB/B,CAAK,EAC9D,QAAS,IAAMkD,EAAaC,CAAG,EAE9B,SAAAA,EAAI,KAAA,EAnBAA,EAAI,KAAA,CAsBf,CAAC,CAAA,CAAA,CAEL,CAAA,CAAA,EAGDpC,GAAsB,MACrBlD,EAAAA,IAACuG,EAAAA,WAAA,CACC,GAAG,OACH,GAAItE,EACJ,QAAQ,YACR,MAAOgB,EAAgB,QAAU,QACjC,UAAWqD,EAAO,OAEjB,SAAApD,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,CAAC"}
@@ -7,9 +7,9 @@ import { a as Ke } from "./names-r21QPjcU.js";
7
7
  import { I as E } from "./Icon-DaTvzLBu.js";
8
8
  import { L as Re } from "./List-LqbfF6gU.js";
9
9
  import { L as We } from "./ListItem-Cn15lJBr.js";
10
- import { L as Fe } from "./Loader-DwmyJFwG.js";
10
+ import { L as Fe } from "./Loader-BZIa8hwv.js";
11
11
  import { T as W } from "./Typography-Cta6Rg4L.js";
12
- import { a as Pe } from "./ConfigProvider-Blhvj6UQ.js";
12
+ import { a as Pe } from "./ConfigProvider-DR9YMy9U.js";
13
13
  const Ve = "_field_17o9l_1", $e = "_fullWidth_17o9l_7", He = "_label_17o9l_13", je = "_required_17o9l_22", Qe = "_control_17o9l_28", ze = "_open_17o9l_47", Ue = "_error_17o9l_52", Ge = "_disabled_17o9l_60", Je = "_value_17o9l_70", Xe = "_valueIcon_17o9l_78", Ye = "_valueLabel_17o9l_82", Ze = "_placeholder_17o9l_87", eo = "_clear_17o9l_92", oo = "_chevron_17o9l_111", lo = "_sm_17o9l_121", ro = "_md_17o9l_125", to = "_lg_17o9l_129", ao = "_helper_17o9l_134", no = "_popover_17o9l_139", so = "_search_17o9l_147", co = "_searchIcon_17o9l_156", io = "_searchInput_17o9l_160", uo = "_listbox_17o9l_176", fo = "_active_17o9l_184", mo = "_noOptions_17o9l_188", po = "_loading_17o9l_194", l = {
14
14
  field: Ve,
15
15
  fullWidth: $e,
@@ -335,4 +335,4 @@ const Eo = Me(function({
335
335
  export {
336
336
  Eo as S
337
337
  };
338
- //# sourceMappingURL=Select-ChT-6_bM.js.map
338
+ //# sourceMappingURL=Select-CdX3Ks7y.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select-ChT-6_bM.js","sources":["../src/components/Select/Select.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { useFormContext } from '../../form/formContext'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { List, ListItem } from '../List'\nimport { Loader } from '../Loader'\nimport { Typography } from '../Typography'\nimport styles from './Select.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type SelectSize = 'sm' | 'md' | 'lg'\n\n/** A single selectable option. */\nexport interface SelectOption {\n /** The value committed when this option is chosen. */\n value: string\n /** Display + search text. */\n label: string\n /** Greys out and blocks selecting this option. */\n disabled?: boolean\n /** Leading icon — a known `IconName` (rendered as `<Icon>`) or any node. */\n icon?: IconName | ReactNode\n}\n\n/** Renders an option's icon (an `IconName` becomes an `<Icon>`; anything else is used as-is). */\nfunction renderIcon(icon: IconName | ReactNode, size: 'sm' | 'md'): ReactNode {\n if (icon == null) return null\n if (typeof icon === 'string' && ICON_NAME_SET.has(icon))\n return <Icon name={icon as IconName} size={size} />\n return icon\n}\n\nexport interface SelectProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** The selectable options. */\n options: SelectOption[]\n /** Preset size — control height, font and option density. */\n size?: SelectSize\n /** Marks the field invalid: red border/ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Disables the field. */\n disabled?: boolean\n /** Controlled value — the chosen option's `value` (`''` = nothing selected). */\n value?: string\n /** Initial value for uncontrolled use. */\n defaultValue?: string\n /** Fires with the next value (`''` when cleared). */\n onChange?: (value: string) => void\n /** Text shown in the trigger when nothing is selected. Defaults to `\"Select…\"`. */\n placeholder?: string\n /** Shows a clear (×) button in the trigger when a value is set. Defaults to `true`. */\n clearable?: boolean\n /** Adds a search box inside the popover that filters options by label. */\n searchable?: boolean\n /** Placeholder for the search box. Defaults to `\"Search…\"`. */\n searchPlaceholder?: string\n /**\n * Fires with the search query as the user types. **Providing this switches off the built-in\n * local filtering** — you own `options` (e.g. fetch them from a server for the current query).\n */\n onSearchChange?: (query: string) => void\n /** Shows a loading indicator in the popover (e.g. while fetching server-side search results). */\n loading?: boolean\n /** Text shown next to the loader while `loading`. Defaults to `\"Loading…\"`. */\n loadingText?: ReactNode\n /**\n * Shown in the popover when no option matches. Defaults to `\"No options\"`. Pass a function\n * `(query) => node` to vary the message by the current search text — e.g. a \"Type to search\" hint\n * while it's empty vs a \"No results\" message after typing.\n */\n noOptionsText?: ReactNode | ((query: string) => ReactNode)\n /** Show the trailing tick on the selected option. Defaults to `true` (the row still gets its tint). */\n showSelectedTick?: boolean\n /** Form field name — auto-binds to a surrounding `<Form>` (value is the option's `value`). */\n name?: string\n /** Id for the trigger (label association). */\n id?: string\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A labeled single-select. The trigger reuses TextField-style chrome (label, helper/error, sizes,\n * `required`, `fullWidth`, `disabled`); clicking it opens a `Dropdown`-style popover — portaled to\n * `<body>`, opening below (flipping above only when it would overflow), locking page scroll,\n * re-positioning on scroll/resize, matching the trigger width, and entering with the shared\n * opacity + translate animation. Options render as `ListItem`s in a `role=\"listbox\"`; the chosen\n * option is highlighted with a tick, disabled options are inert. Full keyboard support\n * (Arrow/Home/End to move, Enter/Space to select, Escape to close, type-ahead) and ARIA\n * (`listbox`/`option`, `aria-activedescendant`, `aria-expanded`). Optionally `searchable` (a filter\n * box) and `clearable` (a × to reset); pass `onSearchChange` to drive the search **server-side** (the\n * consumer owns `options` for the current query — local filtering is skipped) with a `loading`\n * indicator. Controlled (`value` + `onChange`) or uncontrolled\n * (`defaultValue`), and binds to a surrounding `<Form>` by `name` (value = the option's `value`;\n * validate with e.g. `z.string().min(1, 'Required')`). Token-only styling.\n */\nexport const Select = forwardRef<HTMLDivElement, SelectProps>(function Select(\n {\n label,\n options,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n disabled = false,\n value,\n defaultValue,\n onChange,\n placeholder,\n clearable = true,\n searchable = false,\n searchPlaceholder,\n onSearchChange,\n loading = false,\n loadingText,\n noOptionsText,\n showSelectedTick = true,\n name,\n id: idProp,\n className,\n style,\n },\n ref,\n) {\n const reactId = useId()\n const id = idProp ?? reactId\n const labelId = `${id}-label`\n const listboxId = `${id}-listbox`\n const helperId = `${id}-helper`\n const optionId = (index: number) => `${id}-opt-${index}`\n\n const t = useT()\n const searchPh = searchPlaceholder ?? t('common.search')\n\n // ── value (controlled / form-bound / uncontrolled) ─────────────────────────────────────────────\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = isFormBound ? form!.field(name!) : undefined\n const externalValue =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | undefined) ?? '')\n : undefined\n const isControlled = value !== undefined || isFormBound\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentValue = isControlled ? externalValue! : internal\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const selected = options.find((o) => o.value === currentValue)\n const hasValue = selected != null\n\n const commit = (next: string) => {\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n // ── popover open state ─────────────────────────────────────────────────────────────────────────\n const triggerRef = useRef<HTMLDivElement | null>(null)\n const searchInputRef = useRef<HTMLInputElement | null>(null)\n const typeahead = useRef({ buffer: '', timer: 0 })\n // stable handle to the form field's blur (touched) callback — field() returns a fresh object each render\n const fieldBlur = useRef<(() => void) | undefined>(undefined)\n fieldBlur.current = bound ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>) : undefined\n const [open, setOpen] = useState(false)\n const [searchQuery, setSearchQuery] = useState('')\n const [highlightedIndex, setHighlightedIndex] = useState(-1)\n\n const setTriggerRef = useCallback(\n (node: HTMLDivElement | null) => {\n triggerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLDivElement | null }).current = node\n },\n [ref],\n )\n\n // options shown right now. When `onSearchChange` is set the consumer owns `options` (server-side\n // search) — skip the built-in local filter; otherwise filter the given options by label.\n const filteredOptions = useMemo(() => {\n if (!searchable || onSearchChange || !searchQuery.trim()) return options\n const q = searchQuery.trim().toLowerCase()\n return options.filter((o) => o.label.toLowerCase().includes(q))\n }, [searchable, onSearchChange, searchQuery, options])\n\n const findEnabled = useCallback(\n (start: number, delta: number) => {\n let i = start\n while (i >= 0 && i < filteredOptions.length) {\n if (!filteredOptions[i].disabled) return i\n i += delta\n }\n return -1\n },\n [filteredOptions],\n )\n\n // the floating panel forwards its node here, for the focus-leaves-the-widget check on blur\n const popoverRef = useRef<HTMLDivElement | null>(null)\n\n // single dismiss path: clears search + type-ahead buffer, marks the field touched, optionally refocuses\n const closeMenu = useCallback((refocus: boolean) => {\n setOpen(false)\n setSearchQuery('')\n window.clearTimeout(typeahead.current.timer)\n typeahead.current.buffer = ''\n fieldBlur.current?.()\n if (refocus) triggerRef.current?.focus()\n }, [])\n\n // on open: highlight the selected option (or first enabled), focus the search box if searchable\n useEffect(() => {\n if (!open) return\n const selIdx = filteredOptions.findIndex((o) => o.value === currentValue)\n setHighlightedIndex(\n selIdx >= 0 && !filteredOptions[selIdx].disabled ? selIdx : findEnabled(0, 1),\n )\n if (searchable) requestAnimationFrame(() => searchInputRef.current?.focus())\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n // keep the highlighted option scrolled into view\n useEffect(() => {\n if (!open || highlightedIndex < 0) return\n document.getElementById(optionId(highlightedIndex))?.scrollIntoView?.({ block: 'nearest' })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, highlightedIndex])\n\n // when the search filter changes, re-anchor the highlight to the first match\n useEffect(() => {\n if (open && searchable) setHighlightedIndex(findEnabled(0, 1))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchQuery])\n\n // if the option count changes while open (async load / list shrink), keep the highlight in range\n useEffect(() => {\n if (open) setHighlightedIndex((i) => (i < filteredOptions.length ? i : findEnabled(0, 1)))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [filteredOptions.length])\n\n const openMenu = () => {\n if (!disabled) setOpen(true)\n }\n const selectOption = (opt: SelectOption | undefined) => {\n if (!opt || opt.disabled) return\n commit(opt.value)\n closeMenu(true)\n }\n const moveHighlight = (delta: number) => {\n setHighlightedIndex((cur) => {\n const start = cur < 0 ? (delta > 0 ? 0 : filteredOptions.length - 1) : cur + delta\n const found = findEnabled(start, delta)\n return found === -1 ? cur : found\n })\n }\n\n // type-ahead (non-searchable): jump to the option whose label starts with the typed buffer\n const handleTypeahead = (char: string) => {\n const t = typeahead.current\n window.clearTimeout(t.timer)\n t.buffer += char.toLowerCase()\n t.timer = window.setTimeout(() => (t.buffer = ''), 500)\n const match = filteredOptions.findIndex(\n (o) => !o.disabled && o.label.toLowerCase().startsWith(t.buffer),\n )\n if (match >= 0) setHighlightedIndex(match)\n }\n\n const handleKeyDown = (event: ReactKeyboardEvent) => {\n if (disabled) return\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n open ? moveHighlight(1) : openMenu()\n break\n case 'ArrowUp':\n event.preventDefault()\n open ? moveHighlight(-1) : openMenu()\n break\n case 'Enter':\n event.preventDefault()\n if (!open) openMenu()\n else selectOption(filteredOptions[highlightedIndex])\n break\n case ' ':\n // Space opens a closed menu (any mode); selects only when open & not searchable\n // (so a focused search box can still type spaces)\n if (!open) {\n event.preventDefault()\n openMenu()\n } else if (!searchable) {\n event.preventDefault()\n selectOption(filteredOptions[highlightedIndex])\n }\n break\n case 'Escape':\n if (open) {\n event.preventDefault()\n event.stopPropagation() // don't let FloatingPanel's own Escape also fire closeMenu/onBlur\n closeMenu(true)\n }\n break\n case 'Tab':\n // refocus the trigger so Tab continues from the field's visual location, not the portaled\n // search input's DOM position (end of <body>); don't preventDefault — let Tab move on\n if (open) closeMenu(true)\n break\n case 'Home':\n if (open) {\n event.preventDefault()\n setHighlightedIndex(findEnabled(0, 1))\n }\n break\n case 'End':\n if (open) {\n event.preventDefault()\n setHighlightedIndex(findEnabled(filteredOptions.length - 1, -1))\n }\n break\n default:\n if (\n !searchable &&\n open &&\n event.key.length === 1 &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.altKey\n ) {\n handleTypeahead(event.key)\n }\n }\n }\n\n const handleTriggerBlur = (event: FocusEvent<HTMLDivElement>) => {\n // mark the form field touched only when focus leaves the whole widget (not into the popover)\n const next = event.relatedTarget as Node | null\n if (next && (popoverRef.current?.contains(next) || triggerRef.current?.contains(next))) return\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n\n const handleClear = (event: ReactMouseEvent) => {\n event.stopPropagation()\n commit('')\n triggerRef.current?.focus()\n }\n\n const activeId = open && highlightedIndex >= 0 ? optionId(highlightedIndex) : undefined\n const iconSize: 'sm' | 'md' = size === 'sm' ? 'sm' : 'md'\n // chevron size per field size: sm 16 · md 14 · lg 12\n const chevronPx = size === 'sm' ? 16 : size === 'md' ? 14 : 12\n\n return (\n <div\n className={clsx(\n styles.field,\n styles[size],\n fullWidth && styles.fullWidth,\n resolvedError && styles.error,\n disabled && styles.disabled,\n className,\n )}\n style={style}\n >\n {label != null && (\n <span\n id={labelId}\n className={styles.label}\n onClick={() => !disabled && triggerRef.current?.focus()}\n >\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n )}\n\n <div\n ref={setTriggerRef}\n id={id}\n // `name` lets the form's scroll-to-error find + focus this field\n {...(name ? { name } : {})}\n role=\"combobox\"\n tabIndex={disabled ? -1 : 0}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? listboxId : undefined}\n aria-activedescendant={searchable ? undefined : activeId}\n aria-labelledby={label != null ? labelId : undefined}\n aria-disabled={disabled || undefined}\n aria-required={required || undefined}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n className={clsx(styles.control, open && styles.open)}\n onClick={() => (open ? closeMenu(false) : openMenu())}\n onKeyDown={handleKeyDown}\n onBlur={handleTriggerBlur}\n >\n <span className={clsx(styles.value, !hasValue && styles.placeholder)}>\n {selected?.icon != null && (\n <span className={styles.valueIcon}>{renderIcon(selected.icon, iconSize)}</span>\n )}\n <span className={styles.valueLabel}>\n {selected ? selected.label : (placeholder ?? t('select.placeholder'))}\n </span>\n </span>\n\n {clearable && currentValue !== '' && !disabled && (\n <button\n type=\"button\"\n className={styles.clear}\n aria-label={t('select.clear')}\n tabIndex={-1}\n onMouseDown={(e) => e.preventDefault()}\n onClick={handleClear}\n >\n <Icon name=\"CloseCircle\" size=\"sm\" />\n </button>\n )}\n\n <Icon\n name=\"ArrowDown4\"\n className={styles.chevron}\n style={{ width: chevronPx, height: chevronPx }}\n aria-hidden=\"true\"\n />\n </div>\n\n <FloatingPanel\n ref={popoverRef}\n open={open}\n triggerRef={triggerRef}\n onClose={closeMenu}\n matchTriggerWidth\n className={styles.popover}\n >\n {searchable && (\n <div className={styles.search}>\n <Icon name=\"SearchNormal\" size=\"sm\" className={styles.searchIcon} aria-hidden=\"true\" />\n <input\n ref={searchInputRef}\n className={styles.searchInput}\n type=\"text\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-controls={listboxId}\n aria-activedescendant={activeId}\n aria-autocomplete=\"list\"\n aria-label={searchPh}\n placeholder={searchPh}\n value={searchQuery}\n spellCheck={false}\n onChange={(e) => {\n setSearchQuery(e.target.value)\n onSearchChange?.(e.target.value)\n }}\n onKeyDown={handleKeyDown}\n />\n </div>\n )}\n\n {/* the listbox always carries `listboxId` (even when empty) so aria-controls never dangles */}\n <List\n role=\"listbox\"\n id={listboxId}\n aria-labelledby={label != null ? labelId : undefined}\n size={size}\n className={styles.listbox}\n // clear the mouse highlight when the pointer leaves the list (no lingering hover)\n onMouseLeave={() => setHighlightedIndex(-1)}\n >\n {loading ? (\n <div className={styles.loading}>\n <Loader size=\"sm\" />\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {loadingText ?? t('common.loading')}\n </Typography>\n </div>\n ) : filteredOptions.length === 0 ? (\n <div className={styles.noOptions}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {noOptionsText == null\n ? t('select.noOptions')\n : typeof noOptionsText === 'function'\n ? noOptionsText(searchQuery)\n : noOptionsText}\n </Typography>\n </div>\n ) : (\n filteredOptions.map((opt, index) => {\n const isSelected = opt.value === currentValue\n return (\n <ListItem\n key={opt.value}\n id={optionId(index)}\n role=\"option\"\n tabIndex={-1}\n aria-selected={isSelected}\n aria-current={undefined}\n clickable\n selected={isSelected}\n disabled={opt.disabled}\n icon={opt.icon}\n className={clsx(index === highlightedIndex && styles.active)}\n trailing={\n isSelected && showSelectedTick ? (\n <Icon name=\"TickCircle\" size=\"sm\" />\n ) : undefined\n }\n onMouseEnter={() => !opt.disabled && setHighlightedIndex(index)}\n onClick={() => selectOption(opt)}\n >\n {opt.label}\n </ListItem>\n )\n })\n )}\n </List>\n </FloatingPanel>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={styles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["ICON_NAME_SET","ICON_NAMES","renderIcon","icon","size","jsx","Icon","Select","forwardRef","label","options","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","placeholder","clearable","searchable","searchPlaceholder","onSearchChange","loading","loadingText","noOptionsText","showSelectedTick","name","idProp","className","style","ref","reactId","useId","id","labelId","listboxId","helperId","optionId","index","t","useT","searchPh","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","resolvedError","resolvedHelperText","selected","o","hasValue","commit","next","triggerRef","useRef","searchInputRef","typeahead","fieldBlur","open","setOpen","searchQuery","setSearchQuery","highlightedIndex","setHighlightedIndex","setTriggerRef","useCallback","node","filteredOptions","useMemo","q","findEnabled","start","delta","i","popoverRef","closeMenu","refocus","_a","_b","useEffect","selIdx","openMenu","selectOption","opt","moveHighlight","cur","found","handleTypeahead","char","match","handleKeyDown","event","handleTriggerBlur","handleClear","activeId","iconSize","chevronPx","jsxs","clsx","styles","Typography","FloatingPanel","List","Loader","isSelected","ListItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyBMA,KAAgB,IAAI,IAAYC,EAAU;AAiBhD,SAASC,GAAWC,GAA4BC,GAA8B;AAC5E,SAAID,KAAQ,OAAa,OACrB,OAAOA,KAAS,YAAYH,GAAc,IAAIG,CAAI,IAC7C,gBAAAE,EAACC,GAAA,EAAK,MAAMH,GAAkB,MAAAC,EAAA,CAAY,IAC5CD;AACT;AAyEO,MAAMI,KAASC,GAAwC,SAC5D;AAAA,EACE,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAN,IAAO;AAAA,EACP,OAAAO;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,WAA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,IAAI1E,EAASC,CAAK;AAAA,wBAClB,MAAK;AAAA,wBACL,UAAU;AAAA,wBACV,iBAAewE;AAAA,wBACf,gBAAc;AAAA,wBACd,WAAS;AAAA,wBACT,UAAUA;AAAA,wBACV,UAAUrB,EAAI;AAAA,wBACd,MAAMA,EAAI;AAAA,wBACV,WAAWe,EAAKlE,MAAU8B,KAAoBqC,EAAO,MAAM;AAAA,wBAC3D,UACEK,KAAcrF,KACZ,gBAAAtB,EAACC,KAAK,MAAK,cAAa,MAAK,KAAA,CAAK,IAChC;AAAA,wBAEN,cAAc,MAAM,CAACqF,EAAI,YAAYpB,EAAoB/B,CAAK;AAAA,wBAC9D,SAAS,MAAMkD,EAAaC,CAAG;AAAA,wBAE9B,UAAAA,EAAI;AAAA,sBAAA;AAAA,sBAnBAA,EAAI;AAAA,oBAAA;AAAA,kBAsBf,CAAC;AAAA,gBAAA;AAAA,cAAA;AAAA,YAEL;AAAA,UAAA;AAAA,QAAA;AAAA,QAGDpC,KAAsB,QACrB,gBAAAlD;AAAA,UAACuG;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAItE;AAAA,YACJ,SAAQ;AAAA,YACR,OAAOgB,IAAgB,UAAU;AAAA,YACjC,WAAWqD,EAAO;AAAA,YAEjB,UAAApD;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
1
+ {"version":3,"file":"Select-CdX3Ks7y.js","sources":["../src/components/Select/Select.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { useFormContext } from '../../form/formContext'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { List, ListItem } from '../List'\nimport { Loader } from '../Loader'\nimport { Typography } from '../Typography'\nimport styles from './Select.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type SelectSize = 'sm' | 'md' | 'lg'\n\n/** A single selectable option. */\nexport interface SelectOption {\n /** The value committed when this option is chosen. */\n value: string\n /** Display + search text. */\n label: string\n /** Greys out and blocks selecting this option. */\n disabled?: boolean\n /** Leading icon — a known `IconName` (rendered as `<Icon>`) or any node. */\n icon?: IconName | ReactNode\n}\n\n/** Renders an option's icon (an `IconName` becomes an `<Icon>`; anything else is used as-is). */\nfunction renderIcon(icon: IconName | ReactNode, size: 'sm' | 'md'): ReactNode {\n if (icon == null) return null\n if (typeof icon === 'string' && ICON_NAME_SET.has(icon))\n return <Icon name={icon as IconName} size={size} />\n return icon\n}\n\nexport interface SelectProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** The selectable options. */\n options: SelectOption[]\n /** Preset size — control height, font and option density. */\n size?: SelectSize\n /** Marks the field invalid: red border/ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Disables the field. */\n disabled?: boolean\n /** Controlled value — the chosen option's `value` (`''` = nothing selected). */\n value?: string\n /** Initial value for uncontrolled use. */\n defaultValue?: string\n /** Fires with the next value (`''` when cleared). */\n onChange?: (value: string) => void\n /** Text shown in the trigger when nothing is selected. Defaults to `\"Select…\"`. */\n placeholder?: string\n /** Shows a clear (×) button in the trigger when a value is set. Defaults to `true`. */\n clearable?: boolean\n /** Adds a search box inside the popover that filters options by label. */\n searchable?: boolean\n /** Placeholder for the search box. Defaults to `\"Search…\"`. */\n searchPlaceholder?: string\n /**\n * Fires with the search query as the user types. **Providing this switches off the built-in\n * local filtering** — you own `options` (e.g. fetch them from a server for the current query).\n */\n onSearchChange?: (query: string) => void\n /** Shows a loading indicator in the popover (e.g. while fetching server-side search results). */\n loading?: boolean\n /** Text shown next to the loader while `loading`. Defaults to `\"Loading…\"`. */\n loadingText?: ReactNode\n /**\n * Shown in the popover when no option matches. Defaults to `\"No options\"`. Pass a function\n * `(query) => node` to vary the message by the current search text — e.g. a \"Type to search\" hint\n * while it's empty vs a \"No results\" message after typing.\n */\n noOptionsText?: ReactNode | ((query: string) => ReactNode)\n /** Show the trailing tick on the selected option. Defaults to `true` (the row still gets its tint). */\n showSelectedTick?: boolean\n /** Form field name — auto-binds to a surrounding `<Form>` (value is the option's `value`). */\n name?: string\n /** Id for the trigger (label association). */\n id?: string\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A labeled single-select. The trigger reuses TextField-style chrome (label, helper/error, sizes,\n * `required`, `fullWidth`, `disabled`); clicking it opens a `Dropdown`-style popover — portaled to\n * `<body>`, opening below (flipping above only when it would overflow), locking page scroll,\n * re-positioning on scroll/resize, matching the trigger width, and entering with the shared\n * opacity + translate animation. Options render as `ListItem`s in a `role=\"listbox\"`; the chosen\n * option is highlighted with a tick, disabled options are inert. Full keyboard support\n * (Arrow/Home/End to move, Enter/Space to select, Escape to close, type-ahead) and ARIA\n * (`listbox`/`option`, `aria-activedescendant`, `aria-expanded`). Optionally `searchable` (a filter\n * box) and `clearable` (a × to reset); pass `onSearchChange` to drive the search **server-side** (the\n * consumer owns `options` for the current query — local filtering is skipped) with a `loading`\n * indicator. Controlled (`value` + `onChange`) or uncontrolled\n * (`defaultValue`), and binds to a surrounding `<Form>` by `name` (value = the option's `value`;\n * validate with e.g. `z.string().min(1, 'Required')`). Token-only styling.\n */\nexport const Select = forwardRef<HTMLDivElement, SelectProps>(function Select(\n {\n label,\n options,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n disabled = false,\n value,\n defaultValue,\n onChange,\n placeholder,\n clearable = true,\n searchable = false,\n searchPlaceholder,\n onSearchChange,\n loading = false,\n loadingText,\n noOptionsText,\n showSelectedTick = true,\n name,\n id: idProp,\n className,\n style,\n },\n ref,\n) {\n const reactId = useId()\n const id = idProp ?? reactId\n const labelId = `${id}-label`\n const listboxId = `${id}-listbox`\n const helperId = `${id}-helper`\n const optionId = (index: number) => `${id}-opt-${index}`\n\n const t = useT()\n const searchPh = searchPlaceholder ?? t('common.search')\n\n // ── value (controlled / form-bound / uncontrolled) ─────────────────────────────────────────────\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = isFormBound ? form!.field(name!) : undefined\n const externalValue =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | undefined) ?? '')\n : undefined\n const isControlled = value !== undefined || isFormBound\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentValue = isControlled ? externalValue! : internal\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const selected = options.find((o) => o.value === currentValue)\n const hasValue = selected != null\n\n const commit = (next: string) => {\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n // ── popover open state ─────────────────────────────────────────────────────────────────────────\n const triggerRef = useRef<HTMLDivElement | null>(null)\n const searchInputRef = useRef<HTMLInputElement | null>(null)\n const typeahead = useRef({ buffer: '', timer: 0 })\n // stable handle to the form field's blur (touched) callback — field() returns a fresh object each render\n const fieldBlur = useRef<(() => void) | undefined>(undefined)\n fieldBlur.current = bound ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>) : undefined\n const [open, setOpen] = useState(false)\n const [searchQuery, setSearchQuery] = useState('')\n const [highlightedIndex, setHighlightedIndex] = useState(-1)\n\n const setTriggerRef = useCallback(\n (node: HTMLDivElement | null) => {\n triggerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLDivElement | null }).current = node\n },\n [ref],\n )\n\n // options shown right now. When `onSearchChange` is set the consumer owns `options` (server-side\n // search) — skip the built-in local filter; otherwise filter the given options by label.\n const filteredOptions = useMemo(() => {\n if (!searchable || onSearchChange || !searchQuery.trim()) return options\n const q = searchQuery.trim().toLowerCase()\n return options.filter((o) => o.label.toLowerCase().includes(q))\n }, [searchable, onSearchChange, searchQuery, options])\n\n const findEnabled = useCallback(\n (start: number, delta: number) => {\n let i = start\n while (i >= 0 && i < filteredOptions.length) {\n if (!filteredOptions[i].disabled) return i\n i += delta\n }\n return -1\n },\n [filteredOptions],\n )\n\n // the floating panel forwards its node here, for the focus-leaves-the-widget check on blur\n const popoverRef = useRef<HTMLDivElement | null>(null)\n\n // single dismiss path: clears search + type-ahead buffer, marks the field touched, optionally refocuses\n const closeMenu = useCallback((refocus: boolean) => {\n setOpen(false)\n setSearchQuery('')\n window.clearTimeout(typeahead.current.timer)\n typeahead.current.buffer = ''\n fieldBlur.current?.()\n if (refocus) triggerRef.current?.focus()\n }, [])\n\n // on open: highlight the selected option (or first enabled), focus the search box if searchable\n useEffect(() => {\n if (!open) return\n const selIdx = filteredOptions.findIndex((o) => o.value === currentValue)\n setHighlightedIndex(\n selIdx >= 0 && !filteredOptions[selIdx].disabled ? selIdx : findEnabled(0, 1),\n )\n if (searchable) requestAnimationFrame(() => searchInputRef.current?.focus())\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n // keep the highlighted option scrolled into view\n useEffect(() => {\n if (!open || highlightedIndex < 0) return\n document.getElementById(optionId(highlightedIndex))?.scrollIntoView?.({ block: 'nearest' })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, highlightedIndex])\n\n // when the search filter changes, re-anchor the highlight to the first match\n useEffect(() => {\n if (open && searchable) setHighlightedIndex(findEnabled(0, 1))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchQuery])\n\n // if the option count changes while open (async load / list shrink), keep the highlight in range\n useEffect(() => {\n if (open) setHighlightedIndex((i) => (i < filteredOptions.length ? i : findEnabled(0, 1)))\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [filteredOptions.length])\n\n const openMenu = () => {\n if (!disabled) setOpen(true)\n }\n const selectOption = (opt: SelectOption | undefined) => {\n if (!opt || opt.disabled) return\n commit(opt.value)\n closeMenu(true)\n }\n const moveHighlight = (delta: number) => {\n setHighlightedIndex((cur) => {\n const start = cur < 0 ? (delta > 0 ? 0 : filteredOptions.length - 1) : cur + delta\n const found = findEnabled(start, delta)\n return found === -1 ? cur : found\n })\n }\n\n // type-ahead (non-searchable): jump to the option whose label starts with the typed buffer\n const handleTypeahead = (char: string) => {\n const t = typeahead.current\n window.clearTimeout(t.timer)\n t.buffer += char.toLowerCase()\n t.timer = window.setTimeout(() => (t.buffer = ''), 500)\n const match = filteredOptions.findIndex(\n (o) => !o.disabled && o.label.toLowerCase().startsWith(t.buffer),\n )\n if (match >= 0) setHighlightedIndex(match)\n }\n\n const handleKeyDown = (event: ReactKeyboardEvent) => {\n if (disabled) return\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n open ? moveHighlight(1) : openMenu()\n break\n case 'ArrowUp':\n event.preventDefault()\n open ? moveHighlight(-1) : openMenu()\n break\n case 'Enter':\n event.preventDefault()\n if (!open) openMenu()\n else selectOption(filteredOptions[highlightedIndex])\n break\n case ' ':\n // Space opens a closed menu (any mode); selects only when open & not searchable\n // (so a focused search box can still type spaces)\n if (!open) {\n event.preventDefault()\n openMenu()\n } else if (!searchable) {\n event.preventDefault()\n selectOption(filteredOptions[highlightedIndex])\n }\n break\n case 'Escape':\n if (open) {\n event.preventDefault()\n event.stopPropagation() // don't let FloatingPanel's own Escape also fire closeMenu/onBlur\n closeMenu(true)\n }\n break\n case 'Tab':\n // refocus the trigger so Tab continues from the field's visual location, not the portaled\n // search input's DOM position (end of <body>); don't preventDefault — let Tab move on\n if (open) closeMenu(true)\n break\n case 'Home':\n if (open) {\n event.preventDefault()\n setHighlightedIndex(findEnabled(0, 1))\n }\n break\n case 'End':\n if (open) {\n event.preventDefault()\n setHighlightedIndex(findEnabled(filteredOptions.length - 1, -1))\n }\n break\n default:\n if (\n !searchable &&\n open &&\n event.key.length === 1 &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.altKey\n ) {\n handleTypeahead(event.key)\n }\n }\n }\n\n const handleTriggerBlur = (event: FocusEvent<HTMLDivElement>) => {\n // mark the form field touched only when focus leaves the whole widget (not into the popover)\n const next = event.relatedTarget as Node | null\n if (next && (popoverRef.current?.contains(next) || triggerRef.current?.contains(next))) return\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n\n const handleClear = (event: ReactMouseEvent) => {\n event.stopPropagation()\n commit('')\n triggerRef.current?.focus()\n }\n\n const activeId = open && highlightedIndex >= 0 ? optionId(highlightedIndex) : undefined\n const iconSize: 'sm' | 'md' = size === 'sm' ? 'sm' : 'md'\n // chevron size per field size: sm 16 · md 14 · lg 12\n const chevronPx = size === 'sm' ? 16 : size === 'md' ? 14 : 12\n\n return (\n <div\n className={clsx(\n styles.field,\n styles[size],\n fullWidth && styles.fullWidth,\n resolvedError && styles.error,\n disabled && styles.disabled,\n className,\n )}\n style={style}\n >\n {label != null && (\n <span\n id={labelId}\n className={styles.label}\n onClick={() => !disabled && triggerRef.current?.focus()}\n >\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </span>\n )}\n\n <div\n ref={setTriggerRef}\n id={id}\n // `name` lets the form's scroll-to-error find + focus this field\n {...(name ? { name } : {})}\n role=\"combobox\"\n tabIndex={disabled ? -1 : 0}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? listboxId : undefined}\n aria-activedescendant={searchable ? undefined : activeId}\n aria-labelledby={label != null ? labelId : undefined}\n aria-disabled={disabled || undefined}\n aria-required={required || undefined}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n className={clsx(styles.control, open && styles.open)}\n onClick={() => (open ? closeMenu(false) : openMenu())}\n onKeyDown={handleKeyDown}\n onBlur={handleTriggerBlur}\n >\n <span className={clsx(styles.value, !hasValue && styles.placeholder)}>\n {selected?.icon != null && (\n <span className={styles.valueIcon}>{renderIcon(selected.icon, iconSize)}</span>\n )}\n <span className={styles.valueLabel}>\n {selected ? selected.label : (placeholder ?? t('select.placeholder'))}\n </span>\n </span>\n\n {clearable && currentValue !== '' && !disabled && (\n <button\n type=\"button\"\n className={styles.clear}\n aria-label={t('select.clear')}\n tabIndex={-1}\n onMouseDown={(e) => e.preventDefault()}\n onClick={handleClear}\n >\n <Icon name=\"CloseCircle\" size=\"sm\" />\n </button>\n )}\n\n <Icon\n name=\"ArrowDown4\"\n className={styles.chevron}\n style={{ width: chevronPx, height: chevronPx }}\n aria-hidden=\"true\"\n />\n </div>\n\n <FloatingPanel\n ref={popoverRef}\n open={open}\n triggerRef={triggerRef}\n onClose={closeMenu}\n matchTriggerWidth\n className={styles.popover}\n >\n {searchable && (\n <div className={styles.search}>\n <Icon name=\"SearchNormal\" size=\"sm\" className={styles.searchIcon} aria-hidden=\"true\" />\n <input\n ref={searchInputRef}\n className={styles.searchInput}\n type=\"text\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-controls={listboxId}\n aria-activedescendant={activeId}\n aria-autocomplete=\"list\"\n aria-label={searchPh}\n placeholder={searchPh}\n value={searchQuery}\n spellCheck={false}\n onChange={(e) => {\n setSearchQuery(e.target.value)\n onSearchChange?.(e.target.value)\n }}\n onKeyDown={handleKeyDown}\n />\n </div>\n )}\n\n {/* the listbox always carries `listboxId` (even when empty) so aria-controls never dangles */}\n <List\n role=\"listbox\"\n id={listboxId}\n aria-labelledby={label != null ? labelId : undefined}\n size={size}\n className={styles.listbox}\n // clear the mouse highlight when the pointer leaves the list (no lingering hover)\n onMouseLeave={() => setHighlightedIndex(-1)}\n >\n {loading ? (\n <div className={styles.loading}>\n <Loader size=\"sm\" />\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {loadingText ?? t('common.loading')}\n </Typography>\n </div>\n ) : filteredOptions.length === 0 ? (\n <div className={styles.noOptions}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {noOptionsText == null\n ? t('select.noOptions')\n : typeof noOptionsText === 'function'\n ? noOptionsText(searchQuery)\n : noOptionsText}\n </Typography>\n </div>\n ) : (\n filteredOptions.map((opt, index) => {\n const isSelected = opt.value === currentValue\n return (\n <ListItem\n key={opt.value}\n id={optionId(index)}\n role=\"option\"\n tabIndex={-1}\n aria-selected={isSelected}\n aria-current={undefined}\n clickable\n selected={isSelected}\n disabled={opt.disabled}\n icon={opt.icon}\n className={clsx(index === highlightedIndex && styles.active)}\n trailing={\n isSelected && showSelectedTick ? (\n <Icon name=\"TickCircle\" size=\"sm\" />\n ) : undefined\n }\n onMouseEnter={() => !opt.disabled && setHighlightedIndex(index)}\n onClick={() => selectOption(opt)}\n >\n {opt.label}\n </ListItem>\n )\n })\n )}\n </List>\n </FloatingPanel>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={styles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["ICON_NAME_SET","ICON_NAMES","renderIcon","icon","size","jsx","Icon","Select","forwardRef","label","options","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","placeholder","clearable","searchable","searchPlaceholder","onSearchChange","loading","loadingText","noOptionsText","showSelectedTick","name","idProp","className","style","ref","reactId","useId","id","labelId","listboxId","helperId","optionId","index","t","useT","searchPh","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","resolvedError","resolvedHelperText","selected","o","hasValue","commit","next","triggerRef","useRef","searchInputRef","typeahead","fieldBlur","open","setOpen","searchQuery","setSearchQuery","highlightedIndex","setHighlightedIndex","setTriggerRef","useCallback","node","filteredOptions","useMemo","q","findEnabled","start","delta","i","popoverRef","closeMenu","refocus","_a","_b","useEffect","selIdx","openMenu","selectOption","opt","moveHighlight","cur","found","handleTypeahead","char","match","handleKeyDown","event","handleTriggerBlur","handleClear","activeId","iconSize","chevronPx","jsxs","clsx","styles","Typography","FloatingPanel","List","Loader","isSelected","ListItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyBMA,KAAgB,IAAI,IAAYC,EAAU;AAiBhD,SAASC,GAAWC,GAA4BC,GAA8B;AAC5E,SAAID,KAAQ,OAAa,OACrB,OAAOA,KAAS,YAAYH,GAAc,IAAIG,CAAI,IAC7C,gBAAAE,EAACC,GAAA,EAAK,MAAMH,GAAkB,MAAAC,EAAA,CAAY,IAC5CD;AACT;AAyEO,MAAMI,KAASC,GAAwC,SAC5D;AAAA,EACE,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAN,IAAO;AAAA,EACP,OAAAO;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,WAAAC,KAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC,KAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,mBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,SAAAC,KAAU;AAAA,EACV,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,kBAAAC,KAAmB;AAAA,EACnB,MAAAC;AAAA,EACA,IAAIC;AAAA,EACJ,WAAAC;AAAA,EACA,OAAAC;AACF,GACAC,GACA;AACA,QAAMC,KAAUC,GAAA,GACVC,IAAKN,MAAUI,IACfG,IAAU,GAAGD,CAAE,UACfE,IAAY,GAAGF,CAAE,YACjBG,IAAW,GAAGH,CAAE,WAChBI,IAAW,CAACC,MAAkB,GAAGL,CAAE,QAAQK,CAAK,IAEhDC,IAAIC,GAAA,GACJC,IAAWrB,MAAqBmB,EAAE,eAAe,GAGjDG,IAAOC,GAAA,GACPC,IAAc,GAAQF,KAAQhB,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A,UAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAItE;AAAA,YACJ,SAAQ;AAAA,YACR,OAAOgB,IAAgB,UAAU;AAAA,YACjC,WAAWqD,EAAO;AAAA,YAEjB,UAAApD;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
@@ -1,2 +1,2 @@
1
- "use strict";const i=require("react/jsx-runtime"),b=require("react"),h=require("@tanstack/react-router"),O=require("clsx"),E=require("./Icon-BVULqOJD.cjs"),z=require("./List-ChXO0Hz-.cjs"),w=require("./ListItem-yXXjtepZ.cjs"),K=require("./TextField-DzYGA_St.cjs"),M=require("./access-DPUHbE-S.cjs"),V=require("./ConfigProvider-CUG8Mfy2.cjs"),Y="_nav_a1zzi_4",U="_module_a1zzi_17",W="_search_a1zzi_25",H="_searchPanel_a1zzi_31",G="_moduleLabel_a1zzi_46",Q="_leaves_a1zzi_61",X="_navBadge_a1zzi_66",J="_navDot_a1zzi_78",Z="_leafDot_a1zzi_86",ee="_collapsible_a1zzi_95",te="_collapsibleClosed_a1zzi_100",ne="_collapsibleInner_a1zzi_103",oe="_chevron_a1zzi_109",se="_chevronButton_a1zzi_119",m={nav:Y,module:U,search:W,searchPanel:H,moduleLabel:G,leaves:Q,navBadge:X,navDot:J,leafDot:Z,collapsible:ee,collapsibleClosed:te,collapsibleInner:ne,chevron:oe,chevronButton:se},P=w.ListItem,ae=e=>e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "),$=e=>e.replace(/^\/+|\/+$/g,""),D=e=>e.length>1&&e.endsWith("/")?e.slice(0,-1):e,C=(e,n)=>e.order-n.order||e.label.localeCompare(n.label);function A(e){const n=[];for(const l of e){const a=l.staticData,s=$(l.fullPath);!(a!=null&&a.name)||!s||n.push({path:s,name:a.name,sd:a})}const t=new Map(n.map(l=>[l.path,l])),o=n.map(l=>l.path),r=l=>o.some(a=>{var s;return a!==l&&a.startsWith(`${l}/`)&&!((s=t.get(a))!=null&&s.sd.hidden)}),c=new Set(e.map(l=>l.fullPath)),u=l=>c.has(`/${l}/`),f=(l,a)=>{const s=t.get(l);return{label:(s==null?void 0:s.name)??ae(a),icon:s==null?void 0:s.sd.icon,badge:s==null?void 0:s.sd.badge,dot:s==null?void 0:s.sd.dot,order:(s==null?void 0:s.sd.order)??Number.POSITIVE_INFINITY}},g=new Map,d=l=>{let a=g.get(l);if(!a){const s=f(l,l);a={label:s.label,icon:s.icon,order:s.order,groups:new Map},g.set(l,a)}return a},_=[];for(const{path:l,name:a,sd:s}of n){const v=l.split("/");if(v.length<=2&&r(l)||s.hidden)continue;if(v.length===1){_.push({label:a,to:`/${l}`,icon:s.icon,badge:s.badge,dot:s.dot,order:s.order??Number.POSITIVE_INFINITY});continue}const y=d(v[0]);if(v.length===2)y.groups.set(l,{label:a,icon:s.icon,to:`/${l}`,badge:s.badge,dot:s.dot,order:s.order??Number.POSITIVE_INFINITY,leaves:[],isContainer:!1});else{const N=v.slice(0,2).join("/");let L=y.groups.get(N);if(!L){const I=f(N,v[1]);L={label:I.label,icon:I.icon,badge:I.badge,dot:I.dot,order:I.order,to:u(N)?`/${N}`:void 0,leaves:[],isContainer:!0},y.groups.set(N,L)}L.leaves.push({label:a,to:`/${l}`,icon:s.icon,badge:s.badge,dot:s.dot,order:s.order??Number.POSITIVE_INFINITY})}}const p=_.map(l=>({order:l.order,label:l.label,item:{kind:"link",link:{label:l.label,to:l.to,icon:l.icon,badge:l.badge,dot:l.dot}}})),k=[...g.values()].map(l=>({order:l.order,label:l.label,item:{kind:"module",module:{module:l.label,icon:l.icon,groups:[...l.groups.values()].sort(C).map(a=>({label:a.label,icon:a.icon,to:a.to,badge:a.badge,dot:a.dot,children:a.isContainer?a.leaves.sort(C).map(s=>({label:s.label,to:s.to,icon:s.icon,badge:s.badge,dot:s.dot})):void 0}))}}})),x=[...p,...k].sort(C).map(l=>l.item);return{items:x,links:x.flatMap(l=>l.kind==="link"?[l.link]:[]),modules:x.flatMap(l=>l.kind==="module"?[l.module]:[])}}function S(){const e=h.useRouter(),n=M.useAccessKeys();return b.useMemo(()=>A(Object.values(e.looseRoutesById).map(t=>{var o;return{fullPath:t.fullPath,staticData:(o=t.options)==null?void 0:o.staticData}}).filter(t=>{var o;return M.hasAccess((o=t.staticData)==null?void 0:o.roles)})),[e,n])}function B(e){var n;for(const t of e.items){if(t.kind==="link")return t.link.to;for(const o of t.module.groups){if(o.to)return o.to;const r=(n=o.children)==null?void 0:n[0];if(r)return r.to}}}function le(){return B(S())}function re(e){var t;const n=new Map;for(const o of e){const r=(t=o.staticData)==null?void 0:t.name;if(!r)continue;const c=D(o.fullPath);n.has(c)||n.set(c,r)}return n}function F(e,n){const t=[];let o="";for(const r of $(e).split("/").filter(Boolean)){o+=`/${r}`;const c=n.get(o);c&&t.push({name:c,to:o})}return t}function q(){const e=h.useRouter();return b.useMemo(()=>re(Object.values(e.looseRoutesById).map(n=>{var t;return{fullPath:n.fullPath,staticData:(t=n.options)==null?void 0:t.staticData}})),[e])}function R(e,n){if(e!=null)return typeof e=="function"?e(n):e}function ce(e,n,t){return R(e,t)??R(n,t)}function ie(){var n;const e=h.useRouterState({select:t=>t.matches});for(let t=e.length-1;t>=0;t--){const o=R((n=e[t].staticData)==null?void 0:n.title,e[t].params??{});if(o)return o}}function ue(e,n){if(!(e==null||e===!1))return e===!0?{kind:"history"}:{kind:"navigate",to:typeof e=="function"?e(n):e}}function de(){var o;const e=h.useRouter(),n=h.useNavigate(),t=h.useRouterState({select:r=>r.matches});for(let r=t.length-1;r>=0;r--){const c=(o=t[r].staticData)==null?void 0:o.back;if(c==null)continue;const u=ue(c,t[r].params??{});return u?u.kind==="history"?()=>e.history.back():()=>n({to:u.to}):void 0}}function fe(){const e=h.useRouterState({select:n=>n.matches});for(let n=e.length-1;n>=0;n--){const t=e[n].staticData,o=ce(t==null?void 0:t.breadcrumb,t==null?void 0:t.title,e[n].params??{});if(o)return o}}function he(){var n;const e=h.useRouterState({select:t=>t.matches});for(let t=e.length-1;t>=0;t--){const o=(n=e[t].staticData)==null?void 0:n.actions;if(o!=null&&o.length)return o}}function me(){const e=ie(),n=q(),t=h.useRouterState({select:r=>r.location.pathname});if(e!=null)return e;const o=F(t,n);return o.length>0?o[o.length-1].name:void 0}function be(e){const n=new Set;for(const t of e.links)n.add(t.to);for(const t of e.modules)for(const o of t.groups){o.to&&n.add(o.to);for(const r of o.children??[])n.add(r.to)}return n}function pe(e,n){const{leafPath:t,leafTitle:o,navigable:r}=n,c=e.map(({name:u,to:f})=>({label:u,to:f!==t&&r.has(f)?f:void 0}));return o&&(e.length>0&&e[e.length-1].to===t?c[c.length-1]={label:o}:c.push({label:o})),c}function ve(){const e=S(),n=q(),t=h.useRouterState({select:u=>u.location.pathname}),o=fe(),r=B(e),c=pe(F(t,n),{leafPath:D(t),leafTitle:o,navigable:be(e)});return{homeTo:r,items:c}}function ge(){const e=le();return e?i.jsx(h.Navigate,{to:e}):null}function _e(){const{items:e}=S(),n=h.useRouterState({select:c=>c.location.pathname}),t=[];let o=[];const r=()=>{if(o.length===0)return;const c=o;o=[],t.push(i.jsx(z.List,{children:c.map(u=>i.jsx(P,{as:h.Link,to:u.to,icon:u.icon,selected:T(n,u.to),clickable:!0,trailing:j(u.badge,u.dot),children:u.label},u.to))},`links-${c[0].to}`))};for(const c of e){if(c.kind==="link"){o.push(c.link);continue}r();const u=c.module;t.push(i.jsxs("div",{className:m.module,children:[i.jsx("div",{className:m.moduleLabel,children:u.module}),i.jsx(z.List,{children:u.groups.map(f=>i.jsx(Pe,{group:f,pathname:n},f.label))})]},`mod-${u.module}`))}return r(),i.jsx("nav",{className:m.nav,children:t})}function xe(e){const n=[];for(const t of e.links)n.push({label:t.label,to:t.to});for(const t of e.modules)for(const o of t.groups){o.to&&n.push({label:o.label,to:o.to,context:t.module});for(const r of o.children??[])n.push({label:r.label,to:r.to,context:`${t.module} · ${o.label}`})}return n}const ke=8;function Ne(){const e=V.useT(),n=S(),t=h.useNavigate(),o=b.useMemo(()=>xe(n),[n]),[r,c]=b.useState(""),[u,f]=b.useState(!1),[g,d]=b.useState(0),_=b.useRef(null),p=b.useMemo(()=>{const a=r.trim().toLowerCase();return a?o.filter(s=>{var v;return s.label.toLowerCase().includes(a)||(((v=s.context)==null?void 0:v.toLowerCase().includes(a))??!1)}).slice(0,ke):[]},[o,r]),k=u&&p.length>0;b.useEffect(()=>d(0),[r]),b.useEffect(()=>{d(a=>a>p.length-1?Math.max(0,p.length-1):a)},[p.length]),b.useEffect(()=>{if(!u)return;const a=s=>{_.current&&!_.current.contains(s.target)&&f(!1)};return document.addEventListener("pointerdown",a),()=>document.removeEventListener("pointerdown",a)},[u]);const x=a=>{t({to:a}),c(""),f(!1)},l=a=>{if(k)if(a.key==="ArrowDown")a.preventDefault(),d(s=>(s+1)%p.length);else if(a.key==="ArrowUp")a.preventDefault(),d(s=>(s-1+p.length)%p.length);else if(a.key==="Enter"){a.preventDefault();const s=p[g];s&&x(s.to)}else a.key==="Escape"&&f(!1)};return i.jsxs("div",{ref:_,className:m.search,role:"combobox","aria-expanded":k,"aria-haspopup":"listbox",children:[i.jsx(K.TextField,{value:r,onChange:a=>{c(a.target.value),f(!0)},onFocus:()=>f(!0),onKeyDown:l,adornment:i.jsx(E.Icon,{name:"SearchNormal"}),placeholder:e("sidebar.searchPages"),"aria-label":e("sidebar.searchPages"),autoComplete:"off"}),k?i.jsx("div",{className:m.searchPanel,children:i.jsx(z.List,{role:"listbox",children:p.map((a,s)=>i.jsx(w.ListItem,{description:a.context,clickable:!0,selected:s===g,onMouseDown:v=>v.preventDefault(),onMouseEnter:()=>d(s),onClick:()=>x(a.to),children:a.label},a.to))})}):null]})}function T(e,n){const t=D(e),o=D(n);return o==="/"?t==="/":t===o||t.startsWith(o+"/")}function Ie(e,n){var t;return e.to&&T(n,e.to)?!0:((t=e.children)==null?void 0:t.some(o=>T(n,o.to)))??!1}function je(e){return e?i.jsx("span",{className:m.navBadge,children:e}):null}function Le(e){return e?i.jsx("span",{className:m.navDot,style:{background:`var(--tz-color-${e})`}}):null}function j(e,n,t){if(!(e==null&&n==null&&t==null))return i.jsxs(i.Fragment,{children:[je(e),Le(n),t]})}function Pe({group:e,pathname:n}){var f,g;const t=Ie(e,n),o=!!((f=e.children)!=null&&f.length),[r,c]=b.useState(t);if(b.useEffect(()=>{t&&c(!0)},[t]),!o&&e.to)return i.jsx(P,{as:h.Link,to:e.to,icon:e.icon,selected:t,clickable:!0,trailing:j(e.badge,e.dot),children:e.label});const u=i.jsx(E.Icon,{name:"ArrowDown4",size:"sm",className:m.chevron,"data-open":r?"true":"false"});return i.jsxs(i.Fragment,{children:[o&&e.to?i.jsx(P,{as:h.Link,to:e.to,icon:e.icon,selected:t,clickable:!0,onClick:()=>c(!0),trailing:j(e.badge,e.dot,i.jsx("button",{type:"button",className:m.chevronButton,"aria-label":`${r?"Collapse":"Expand"} ${e.label}`,"aria-expanded":r,onClick:d=>{d.preventDefault(),d.stopPropagation(),c(_=>!_)},children:u})),children:e.label}):i.jsx(w.ListItem,{icon:e.icon,selected:t,clickable:!0,"aria-expanded":r,onClick:()=>c(d=>!d),trailing:j(e.badge,e.dot,u),children:e.label}),o?i.jsx("div",{className:O.clsx(m.collapsible,!r&&m.collapsibleClosed),children:i.jsx("div",{className:m.collapsibleInner,children:i.jsx(z.List,{className:m.leaves,children:(g=e.children)==null?void 0:g.map(d=>i.jsx(P,{as:h.Link,to:d.to,icon:i.jsx("span",{className:m.leafDot}),selected:T(n,d.to),size:"md",clickable:!0,trailing:j(d.badge,d.dot),children:d.label},d.to))})})}):null]})}exports.FirstRouteRedirect=ge;exports.NavSearch=Ne;exports.Sidebar=_e;exports.buildNavTree=A;exports.firstNavTo=B;exports.useBreadcrumbs=ve;exports.useLeafActions=he;exports.usePageBack=de;exports.usePageTitle=me;
2
- //# sourceMappingURL=Sidebar-D2MsR33k.cjs.map
1
+ "use strict";const i=require("react/jsx-runtime"),b=require("react"),h=require("@tanstack/react-router"),O=require("clsx"),E=require("./Icon-BVULqOJD.cjs"),z=require("./List-ChXO0Hz-.cjs"),w=require("./ListItem-yXXjtepZ.cjs"),K=require("./TextField-Df_kGy2l.cjs"),M=require("./access-DPUHbE-S.cjs"),V=require("./ConfigProvider-Bszl3Wr3.cjs"),Y="_nav_a1zzi_4",U="_module_a1zzi_17",W="_search_a1zzi_25",H="_searchPanel_a1zzi_31",G="_moduleLabel_a1zzi_46",Q="_leaves_a1zzi_61",X="_navBadge_a1zzi_66",J="_navDot_a1zzi_78",Z="_leafDot_a1zzi_86",ee="_collapsible_a1zzi_95",te="_collapsibleClosed_a1zzi_100",ne="_collapsibleInner_a1zzi_103",oe="_chevron_a1zzi_109",se="_chevronButton_a1zzi_119",m={nav:Y,module:U,search:W,searchPanel:H,moduleLabel:G,leaves:Q,navBadge:X,navDot:J,leafDot:Z,collapsible:ee,collapsibleClosed:te,collapsibleInner:ne,chevron:oe,chevronButton:se},P=w.ListItem,ae=e=>e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "),$=e=>e.replace(/^\/+|\/+$/g,""),D=e=>e.length>1&&e.endsWith("/")?e.slice(0,-1):e,C=(e,n)=>e.order-n.order||e.label.localeCompare(n.label);function A(e){const n=[];for(const l of e){const a=l.staticData,s=$(l.fullPath);!(a!=null&&a.name)||!s||n.push({path:s,name:a.name,sd:a})}const t=new Map(n.map(l=>[l.path,l])),o=n.map(l=>l.path),r=l=>o.some(a=>{var s;return a!==l&&a.startsWith(`${l}/`)&&!((s=t.get(a))!=null&&s.sd.hidden)}),c=new Set(e.map(l=>l.fullPath)),u=l=>c.has(`/${l}/`),f=(l,a)=>{const s=t.get(l);return{label:(s==null?void 0:s.name)??ae(a),icon:s==null?void 0:s.sd.icon,badge:s==null?void 0:s.sd.badge,dot:s==null?void 0:s.sd.dot,order:(s==null?void 0:s.sd.order)??Number.POSITIVE_INFINITY}},g=new Map,d=l=>{let a=g.get(l);if(!a){const s=f(l,l);a={label:s.label,icon:s.icon,order:s.order,groups:new Map},g.set(l,a)}return a},_=[];for(const{path:l,name:a,sd:s}of n){const v=l.split("/");if(v.length<=2&&r(l)||s.hidden)continue;if(v.length===1){_.push({label:a,to:`/${l}`,icon:s.icon,badge:s.badge,dot:s.dot,order:s.order??Number.POSITIVE_INFINITY});continue}const y=d(v[0]);if(v.length===2)y.groups.set(l,{label:a,icon:s.icon,to:`/${l}`,badge:s.badge,dot:s.dot,order:s.order??Number.POSITIVE_INFINITY,leaves:[],isContainer:!1});else{const N=v.slice(0,2).join("/");let L=y.groups.get(N);if(!L){const I=f(N,v[1]);L={label:I.label,icon:I.icon,badge:I.badge,dot:I.dot,order:I.order,to:u(N)?`/${N}`:void 0,leaves:[],isContainer:!0},y.groups.set(N,L)}L.leaves.push({label:a,to:`/${l}`,icon:s.icon,badge:s.badge,dot:s.dot,order:s.order??Number.POSITIVE_INFINITY})}}const p=_.map(l=>({order:l.order,label:l.label,item:{kind:"link",link:{label:l.label,to:l.to,icon:l.icon,badge:l.badge,dot:l.dot}}})),k=[...g.values()].map(l=>({order:l.order,label:l.label,item:{kind:"module",module:{module:l.label,icon:l.icon,groups:[...l.groups.values()].sort(C).map(a=>({label:a.label,icon:a.icon,to:a.to,badge:a.badge,dot:a.dot,children:a.isContainer?a.leaves.sort(C).map(s=>({label:s.label,to:s.to,icon:s.icon,badge:s.badge,dot:s.dot})):void 0}))}}})),x=[...p,...k].sort(C).map(l=>l.item);return{items:x,links:x.flatMap(l=>l.kind==="link"?[l.link]:[]),modules:x.flatMap(l=>l.kind==="module"?[l.module]:[])}}function S(){const e=h.useRouter(),n=M.useAccessKeys();return b.useMemo(()=>A(Object.values(e.looseRoutesById).map(t=>{var o;return{fullPath:t.fullPath,staticData:(o=t.options)==null?void 0:o.staticData}}).filter(t=>{var o;return M.hasAccess((o=t.staticData)==null?void 0:o.roles)})),[e,n])}function B(e){var n;for(const t of e.items){if(t.kind==="link")return t.link.to;for(const o of t.module.groups){if(o.to)return o.to;const r=(n=o.children)==null?void 0:n[0];if(r)return r.to}}}function le(){return B(S())}function re(e){var t;const n=new Map;for(const o of e){const r=(t=o.staticData)==null?void 0:t.name;if(!r)continue;const c=D(o.fullPath);n.has(c)||n.set(c,r)}return n}function F(e,n){const t=[];let o="";for(const r of $(e).split("/").filter(Boolean)){o+=`/${r}`;const c=n.get(o);c&&t.push({name:c,to:o})}return t}function q(){const e=h.useRouter();return b.useMemo(()=>re(Object.values(e.looseRoutesById).map(n=>{var t;return{fullPath:n.fullPath,staticData:(t=n.options)==null?void 0:t.staticData}})),[e])}function R(e,n){if(e!=null)return typeof e=="function"?e(n):e}function ce(e,n,t){return R(e,t)??R(n,t)}function ie(){var n;const e=h.useRouterState({select:t=>t.matches});for(let t=e.length-1;t>=0;t--){const o=R((n=e[t].staticData)==null?void 0:n.title,e[t].params??{});if(o)return o}}function ue(e,n){if(!(e==null||e===!1))return e===!0?{kind:"history"}:{kind:"navigate",to:typeof e=="function"?e(n):e}}function de(){var o;const e=h.useRouter(),n=h.useNavigate(),t=h.useRouterState({select:r=>r.matches});for(let r=t.length-1;r>=0;r--){const c=(o=t[r].staticData)==null?void 0:o.back;if(c==null)continue;const u=ue(c,t[r].params??{});return u?u.kind==="history"?()=>e.history.back():()=>n({to:u.to}):void 0}}function fe(){const e=h.useRouterState({select:n=>n.matches});for(let n=e.length-1;n>=0;n--){const t=e[n].staticData,o=ce(t==null?void 0:t.breadcrumb,t==null?void 0:t.title,e[n].params??{});if(o)return o}}function he(){var n;const e=h.useRouterState({select:t=>t.matches});for(let t=e.length-1;t>=0;t--){const o=(n=e[t].staticData)==null?void 0:n.actions;if(o!=null&&o.length)return o}}function me(){const e=ie(),n=q(),t=h.useRouterState({select:r=>r.location.pathname});if(e!=null)return e;const o=F(t,n);return o.length>0?o[o.length-1].name:void 0}function be(e){const n=new Set;for(const t of e.links)n.add(t.to);for(const t of e.modules)for(const o of t.groups){o.to&&n.add(o.to);for(const r of o.children??[])n.add(r.to)}return n}function pe(e,n){const{leafPath:t,leafTitle:o,navigable:r}=n,c=e.map(({name:u,to:f})=>({label:u,to:f!==t&&r.has(f)?f:void 0}));return o&&(e.length>0&&e[e.length-1].to===t?c[c.length-1]={label:o}:c.push({label:o})),c}function ve(){const e=S(),n=q(),t=h.useRouterState({select:u=>u.location.pathname}),o=fe(),r=B(e),c=pe(F(t,n),{leafPath:D(t),leafTitle:o,navigable:be(e)});return{homeTo:r,items:c}}function ge(){const e=le();return e?i.jsx(h.Navigate,{to:e}):null}function _e(){const{items:e}=S(),n=h.useRouterState({select:c=>c.location.pathname}),t=[];let o=[];const r=()=>{if(o.length===0)return;const c=o;o=[],t.push(i.jsx(z.List,{children:c.map(u=>i.jsx(P,{as:h.Link,to:u.to,icon:u.icon,selected:T(n,u.to),clickable:!0,trailing:j(u.badge,u.dot),children:u.label},u.to))},`links-${c[0].to}`))};for(const c of e){if(c.kind==="link"){o.push(c.link);continue}r();const u=c.module;t.push(i.jsxs("div",{className:m.module,children:[i.jsx("div",{className:m.moduleLabel,children:u.module}),i.jsx(z.List,{children:u.groups.map(f=>i.jsx(Pe,{group:f,pathname:n},f.label))})]},`mod-${u.module}`))}return r(),i.jsx("nav",{className:m.nav,children:t})}function xe(e){const n=[];for(const t of e.links)n.push({label:t.label,to:t.to});for(const t of e.modules)for(const o of t.groups){o.to&&n.push({label:o.label,to:o.to,context:t.module});for(const r of o.children??[])n.push({label:r.label,to:r.to,context:`${t.module} · ${o.label}`})}return n}const ke=8;function Ne(){const e=V.useT(),n=S(),t=h.useNavigate(),o=b.useMemo(()=>xe(n),[n]),[r,c]=b.useState(""),[u,f]=b.useState(!1),[g,d]=b.useState(0),_=b.useRef(null),p=b.useMemo(()=>{const a=r.trim().toLowerCase();return a?o.filter(s=>{var v;return s.label.toLowerCase().includes(a)||(((v=s.context)==null?void 0:v.toLowerCase().includes(a))??!1)}).slice(0,ke):[]},[o,r]),k=u&&p.length>0;b.useEffect(()=>d(0),[r]),b.useEffect(()=>{d(a=>a>p.length-1?Math.max(0,p.length-1):a)},[p.length]),b.useEffect(()=>{if(!u)return;const a=s=>{_.current&&!_.current.contains(s.target)&&f(!1)};return document.addEventListener("pointerdown",a),()=>document.removeEventListener("pointerdown",a)},[u]);const x=a=>{t({to:a}),c(""),f(!1)},l=a=>{if(k)if(a.key==="ArrowDown")a.preventDefault(),d(s=>(s+1)%p.length);else if(a.key==="ArrowUp")a.preventDefault(),d(s=>(s-1+p.length)%p.length);else if(a.key==="Enter"){a.preventDefault();const s=p[g];s&&x(s.to)}else a.key==="Escape"&&f(!1)};return i.jsxs("div",{ref:_,className:m.search,role:"combobox","aria-expanded":k,"aria-haspopup":"listbox",children:[i.jsx(K.TextField,{value:r,onChange:a=>{c(a.target.value),f(!0)},onFocus:()=>f(!0),onKeyDown:l,adornment:i.jsx(E.Icon,{name:"SearchNormal"}),placeholder:e("sidebar.searchPages"),"aria-label":e("sidebar.searchPages"),autoComplete:"off"}),k?i.jsx("div",{className:m.searchPanel,children:i.jsx(z.List,{role:"listbox",children:p.map((a,s)=>i.jsx(w.ListItem,{description:a.context,clickable:!0,selected:s===g,onMouseDown:v=>v.preventDefault(),onMouseEnter:()=>d(s),onClick:()=>x(a.to),children:a.label},a.to))})}):null]})}function T(e,n){const t=D(e),o=D(n);return o==="/"?t==="/":t===o||t.startsWith(o+"/")}function Ie(e,n){var t;return e.to&&T(n,e.to)?!0:((t=e.children)==null?void 0:t.some(o=>T(n,o.to)))??!1}function je(e){return e?i.jsx("span",{className:m.navBadge,children:e}):null}function Le(e){return e?i.jsx("span",{className:m.navDot,style:{background:`var(--tz-color-${e})`}}):null}function j(e,n,t){if(!(e==null&&n==null&&t==null))return i.jsxs(i.Fragment,{children:[je(e),Le(n),t]})}function Pe({group:e,pathname:n}){var f,g;const t=Ie(e,n),o=!!((f=e.children)!=null&&f.length),[r,c]=b.useState(t);if(b.useEffect(()=>{t&&c(!0)},[t]),!o&&e.to)return i.jsx(P,{as:h.Link,to:e.to,icon:e.icon,selected:t,clickable:!0,trailing:j(e.badge,e.dot),children:e.label});const u=i.jsx(E.Icon,{name:"ArrowDown4",size:"sm",className:m.chevron,"data-open":r?"true":"false"});return i.jsxs(i.Fragment,{children:[o&&e.to?i.jsx(P,{as:h.Link,to:e.to,icon:e.icon,selected:t,clickable:!0,onClick:()=>c(!0),trailing:j(e.badge,e.dot,i.jsx("button",{type:"button",className:m.chevronButton,"aria-label":`${r?"Collapse":"Expand"} ${e.label}`,"aria-expanded":r,onClick:d=>{d.preventDefault(),d.stopPropagation(),c(_=>!_)},children:u})),children:e.label}):i.jsx(w.ListItem,{icon:e.icon,selected:t,clickable:!0,"aria-expanded":r,onClick:()=>c(d=>!d),trailing:j(e.badge,e.dot,u),children:e.label}),o?i.jsx("div",{className:O.clsx(m.collapsible,!r&&m.collapsibleClosed),children:i.jsx("div",{className:m.collapsibleInner,children:i.jsx(z.List,{className:m.leaves,children:(g=e.children)==null?void 0:g.map(d=>i.jsx(P,{as:h.Link,to:d.to,icon:i.jsx("span",{className:m.leafDot}),selected:T(n,d.to),size:"md",clickable:!0,trailing:j(d.badge,d.dot),children:d.label},d.to))})})}):null]})}exports.FirstRouteRedirect=ge;exports.NavSearch=Ne;exports.Sidebar=_e;exports.buildNavTree=A;exports.firstNavTo=B;exports.useBreadcrumbs=ve;exports.useLeafActions=he;exports.usePageBack=de;exports.usePageTitle=me;
2
+ //# sourceMappingURL=Sidebar-DcKIEfhy.cjs.map