@techzyapp/ui-library 1.0.4 → 1.0.9

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 (415) hide show
  1. package/dist/{Alert-BQpA48PY.js → Alert-B3rDvpbO.js} +3 -3
  2. package/dist/{Alert-BQpA48PY.js.map → Alert-B3rDvpbO.js.map} +1 -1
  3. package/dist/{Alert-DKIjM-9x.cjs → Alert-D99G0StL.cjs} +2 -2
  4. package/dist/{Alert-DKIjM-9x.cjs.map → Alert-D99G0StL.cjs.map} +1 -1
  5. package/dist/{Breadcrumbs-CHONper7.cjs → Breadcrumbs-BnxhmyK5.cjs} +2 -2
  6. package/dist/{Breadcrumbs-CHONper7.cjs.map → Breadcrumbs-BnxhmyK5.cjs.map} +1 -1
  7. package/dist/{Breadcrumbs-Bx5UgwDy.js → Breadcrumbs-DvgctFLS.js} +3 -3
  8. package/dist/{Breadcrumbs-Bx5UgwDy.js.map → Breadcrumbs-DvgctFLS.js.map} +1 -1
  9. package/dist/{Button-DhEv0YFk.js → Button-CUsXYM-m.js} +2 -2
  10. package/dist/{Button-DhEv0YFk.js.map → Button-CUsXYM-m.js.map} +1 -1
  11. package/dist/{Button-D4bfVNNa.cjs → Button-Cj6pckNl.cjs} +2 -2
  12. package/dist/{Button-D4bfVNNa.cjs.map → Button-Cj6pckNl.cjs.map} +1 -1
  13. package/dist/{Calendar-C8uNezI-.cjs → Calendar-Br4C0x0n.cjs} +2 -2
  14. package/dist/{Calendar-C8uNezI-.cjs.map → Calendar-Br4C0x0n.cjs.map} +1 -1
  15. package/dist/{Calendar-Bh317SaV.js → Calendar-CE_9WNAB.js} +3 -3
  16. package/dist/{Calendar-Bh317SaV.js.map → Calendar-CE_9WNAB.js.map} +1 -1
  17. package/dist/{Card-CfyaerZZ.cjs → Card-DD9SWHzZ.cjs} +2 -2
  18. package/dist/{Card-CfyaerZZ.cjs.map → Card-DD9SWHzZ.cjs.map} +1 -1
  19. package/dist/{Card-DzClqJuu.js → Card-DhpudGvF.js} +2 -2
  20. package/dist/{Card-DzClqJuu.js.map → Card-DhpudGvF.js.map} +1 -1
  21. package/dist/{Chip-DSrdXLBU.cjs → Chip-B2lY4TJ0.cjs} +2 -2
  22. package/dist/{Chip-DSrdXLBU.cjs.map → Chip-B2lY4TJ0.cjs.map} +1 -1
  23. package/dist/{Chip-Cfo0v3Z8.js → Chip-DulHqhuf.js} +2 -2
  24. package/dist/{Chip-Cfo0v3Z8.js.map → Chip-DulHqhuf.js.map} +1 -1
  25. package/dist/{CodeBlock-BWxQyKRo.js → CodeBlock-DwBMghs2.js} +3 -3
  26. package/dist/{CodeBlock-BWxQyKRo.js.map → CodeBlock-DwBMghs2.js.map} +1 -1
  27. package/dist/{CodeBlock-CgXOjKS-.cjs → CodeBlock-EhB7v9-R.cjs} +2 -2
  28. package/dist/{CodeBlock-CgXOjKS-.cjs.map → CodeBlock-EhB7v9-R.cjs.map} +1 -1
  29. package/dist/{Col-D2TfZKiM.js → Col-B51RlwWP.js} +2 -2
  30. package/dist/{Col-D2TfZKiM.js.map → Col-B51RlwWP.js.map} +1 -1
  31. package/dist/{Col-R5mAy8T9.cjs → Col-BdQeyKEX.cjs} +2 -2
  32. package/dist/{Col-R5mAy8T9.cjs.map → Col-BdQeyKEX.cjs.map} +1 -1
  33. package/dist/{ColorPicker-2udt1ORM.js → ColorPicker-DJgTeHht.js} +3 -3
  34. package/dist/{ColorPicker-2udt1ORM.js.map → ColorPicker-DJgTeHht.js.map} +1 -1
  35. package/dist/{ColorPicker-BwmaXCOy.cjs → ColorPicker-Dc1y9Zuu.cjs} +2 -2
  36. package/dist/{ColorPicker-BwmaXCOy.cjs.map → ColorPicker-Dc1y9Zuu.cjs.map} +1 -1
  37. package/dist/{ColorPickerPanel-BM9OwDDE.js → ColorPickerPanel-9tOQUL38.js} +2 -2
  38. package/dist/{ColorPickerPanel-BM9OwDDE.js.map → ColorPickerPanel-9tOQUL38.js.map} +1 -1
  39. package/dist/{ColorPickerPanel-ByB1mLSi.cjs → ColorPickerPanel-nXEliruE.cjs} +2 -2
  40. package/dist/{ColorPickerPanel-ByB1mLSi.cjs.map → ColorPickerPanel-nXEliruE.cjs.map} +1 -1
  41. package/dist/ConfigProvider-BHNx-NHV.cjs +2 -0
  42. package/dist/ConfigProvider-BHNx-NHV.cjs.map +1 -0
  43. package/dist/ConfigProvider-BYruQYHC.js +296 -0
  44. package/dist/ConfigProvider-BYruQYHC.js.map +1 -0
  45. package/dist/CopyButton-B4-OYsYr.js +31 -0
  46. package/dist/CopyButton-B4-OYsYr.js.map +1 -0
  47. package/dist/CopyButton-D_DCLHhb.cjs +2 -0
  48. package/dist/CopyButton-D_DCLHhb.cjs.map +1 -0
  49. package/dist/DashedButton-DeiALUPA.js +59 -0
  50. package/dist/DashedButton-DeiALUPA.js.map +1 -0
  51. package/dist/DashedButton-q7AOqKUE.cjs +2 -0
  52. package/dist/DashedButton-q7AOqKUE.cjs.map +1 -0
  53. package/dist/{DatePicker-DF4Epkn8.cjs → DatePicker-CEczjGZy.cjs} +2 -2
  54. package/dist/{DatePicker-DF4Epkn8.cjs.map → DatePicker-CEczjGZy.cjs.map} +1 -1
  55. package/dist/{DatePicker-WM9TC6L_.js → DatePicker-DkvfSN1K.js} +4 -4
  56. package/dist/{DatePicker-WM9TC6L_.js.map → DatePicker-DkvfSN1K.js.map} +1 -1
  57. package/dist/{DateTimePicker-C557OjBU.cjs → DateTimePicker-CDyGxUBX.cjs} +2 -2
  58. package/dist/{DateTimePicker-C557OjBU.cjs.map → DateTimePicker-CDyGxUBX.cjs.map} +1 -1
  59. package/dist/{DateTimePicker-DBtcWK0F.js → DateTimePicker-DPomyrnN.js} +7 -7
  60. package/dist/{DateTimePicker-DBtcWK0F.js.map → DateTimePicker-DPomyrnN.js.map} +1 -1
  61. package/dist/{Dropdown-DKAXue5_.js → Dropdown-FfkmluRu.js} +2 -2
  62. package/dist/{Dropdown-DKAXue5_.js.map → Dropdown-FfkmluRu.js.map} +1 -1
  63. package/dist/{Dropdown-DygP50OB.cjs → Dropdown-Ui7h2TGd.cjs} +2 -2
  64. package/dist/{Dropdown-DygP50OB.cjs.map → Dropdown-Ui7h2TGd.cjs.map} +1 -1
  65. package/dist/{EmptyState-CCCpZ-ZA.cjs → EmptyState-B77utgEn.cjs} +2 -2
  66. package/dist/{EmptyState-CCCpZ-ZA.cjs.map → EmptyState-B77utgEn.cjs.map} +1 -1
  67. package/dist/{EmptyState-CetM49vk.js → EmptyState-CVyFXprK.js} +2 -2
  68. package/dist/{EmptyState-CetM49vk.js.map → EmptyState-CVyFXprK.js.map} +1 -1
  69. package/dist/FileCard-Cpc5frNm.js +148 -0
  70. package/dist/FileCard-Cpc5frNm.js.map +1 -0
  71. package/dist/FileCard-CsGW2sxE.cjs +2 -0
  72. package/dist/FileCard-CsGW2sxE.cjs.map +1 -0
  73. package/dist/{FileUploader-VtmmwUFE.js → FileUploader-B_nKMh_K.js} +5 -5
  74. package/dist/{FileUploader-VtmmwUFE.js.map → FileUploader-B_nKMh_K.js.map} +1 -1
  75. package/dist/{FileUploader-B4TJHyoi.cjs → FileUploader-DDi_uzIx.cjs} +2 -2
  76. package/dist/{FileUploader-B4TJHyoi.cjs.map → FileUploader-DDi_uzIx.cjs.map} +1 -1
  77. package/dist/{Flag-EPZOrH-U.cjs → Flag-BJLWKB9J.cjs} +2 -2
  78. package/dist/{Flag-EPZOrH-U.cjs.map → Flag-BJLWKB9J.cjs.map} +1 -1
  79. package/dist/{Flag-BWCX6oSR.js → Flag-Ck1xK22A.js} +2 -2
  80. package/dist/{Flag-BWCX6oSR.js.map → Flag-Ck1xK22A.js.map} +1 -1
  81. package/dist/Flex-BFn4P1tJ.js +52 -0
  82. package/dist/Flex-BFn4P1tJ.js.map +1 -0
  83. package/dist/Flex-C6tHC8n7.cjs +2 -0
  84. package/dist/Flex-C6tHC8n7.cjs.map +1 -0
  85. package/dist/{FullscreenToggle-oWzYqUPH.js → FullscreenToggle-DmC0jTay.js} +3 -3
  86. package/dist/{FullscreenToggle-oWzYqUPH.js.map → FullscreenToggle-DmC0jTay.js.map} +1 -1
  87. package/dist/{FullscreenToggle-DDKN5n8B.cjs → FullscreenToggle-MCxGzAEe.cjs} +2 -2
  88. package/dist/{FullscreenToggle-DDKN5n8B.cjs.map → FullscreenToggle-MCxGzAEe.cjs.map} +1 -1
  89. package/dist/Grid-5k6dy-F5.js +26 -0
  90. package/dist/Grid-5k6dy-F5.js.map +1 -0
  91. package/dist/Grid-frN0D9lR.cjs +2 -0
  92. package/dist/Grid-frN0D9lR.cjs.map +1 -0
  93. package/dist/{IconButton-CBusrDa9.js → IconButton-B8FPGgDn.js} +2 -2
  94. package/dist/{IconButton-CBusrDa9.js.map → IconButton-B8FPGgDn.js.map} +1 -1
  95. package/dist/{IconButton-D6TenQZ_.cjs → IconButton-BoY2y_pV.cjs} +2 -2
  96. package/dist/{IconButton-D6TenQZ_.cjs.map → IconButton-BoY2y_pV.cjs.map} +1 -1
  97. package/dist/{List-CNz2M3-q.cjs → List-ChXO0Hz-.cjs} +2 -2
  98. package/dist/{List-CNz2M3-q.cjs.map → List-ChXO0Hz-.cjs.map} +1 -1
  99. package/dist/{List-BHgFI9Ll.js → List-LqbfF6gU.js} +2 -2
  100. package/dist/{List-BHgFI9Ll.js.map → List-LqbfF6gU.js.map} +1 -1
  101. package/dist/{ListItem-B4yqZR-Z.js → ListItem-B4Upc0Hy.js} +2 -2
  102. package/dist/{ListItem-B4yqZR-Z.js.map → ListItem-B4Upc0Hy.js.map} +1 -1
  103. package/dist/{ListItem-RH-D-Wey.cjs → ListItem-DWQorRxG.cjs} +2 -2
  104. package/dist/{ListItem-RH-D-Wey.cjs.map → ListItem-DWQorRxG.cjs.map} +1 -1
  105. package/dist/{Loader-D1MtlQOH.cjs → Loader-Cwb1bOHj.cjs} +2 -2
  106. package/dist/{Loader-D1MtlQOH.cjs.map → Loader-Cwb1bOHj.cjs.map} +1 -1
  107. package/dist/{Loader-C4JoXOyA.js → Loader-UzzqvFyo.js} +2 -2
  108. package/dist/{Loader-C4JoXOyA.js.map → Loader-UzzqvFyo.js.map} +1 -1
  109. package/dist/Masonry-9LrJKlhI.cjs +2 -0
  110. package/dist/Masonry-9LrJKlhI.cjs.map +1 -0
  111. package/dist/Masonry-BsRWG-oN.js +92 -0
  112. package/dist/Masonry-BsRWG-oN.js.map +1 -0
  113. package/dist/{Modal-B2YSCVVt.cjs → Modal-CO3c3sGY.cjs} +2 -2
  114. package/dist/{Modal-B2YSCVVt.cjs.map → Modal-CO3c3sGY.cjs.map} +1 -1
  115. package/dist/{Modal-BuaPDlKV.js → Modal-XMRDPHvQ.js} +3 -3
  116. package/dist/{Modal-BuaPDlKV.js.map → Modal-XMRDPHvQ.js.map} +1 -1
  117. package/dist/{MultiSelect-BGRT_B60.js → MultiSelect-BPLctumx.js} +6 -6
  118. package/dist/{MultiSelect-BGRT_B60.js.map → MultiSelect-BPLctumx.js.map} +1 -1
  119. package/dist/{MultiSelect-CSJKSWpA.cjs → MultiSelect-DVOVHuIm.cjs} +2 -2
  120. package/dist/{MultiSelect-CSJKSWpA.cjs.map → MultiSelect-DVOVHuIm.cjs.map} +1 -1
  121. package/dist/{NumberField-DBpO-Z_7.cjs → NumberField-BH237Vt2.cjs} +2 -2
  122. package/dist/{NumberField-DBpO-Z_7.cjs.map → NumberField-BH237Vt2.cjs.map} +1 -1
  123. package/dist/{NumberField-DBvhSQCw.js → NumberField-X2HsSpu9.js} +3 -3
  124. package/dist/{NumberField-DBvhSQCw.js.map → NumberField-X2HsSpu9.js.map} +1 -1
  125. package/dist/{OtpField-CTq-CUbF.js → OtpField-CB05q0NX.js} +2 -2
  126. package/dist/{OtpField-CTq-CUbF.js.map → OtpField-CB05q0NX.js.map} +1 -1
  127. package/dist/{OtpField-BUBYyorC.cjs → OtpField-CXP59zM2.cjs} +2 -2
  128. package/dist/{OtpField-BUBYyorC.cjs.map → OtpField-CXP59zM2.cjs.map} +1 -1
  129. package/dist/{PageLayout-Dfbjw6jD.cjs → PageLayout-CuVuZEbR.cjs} +2 -2
  130. package/dist/{PageLayout-Dfbjw6jD.cjs.map → PageLayout-CuVuZEbR.cjs.map} +1 -1
  131. package/dist/{PageLayout-DddzYw2B.js → PageLayout-WKWnj5cw.js} +2 -2
  132. package/dist/{PageLayout-DddzYw2B.js.map → PageLayout-WKWnj5cw.js.map} +1 -1
  133. package/dist/PageNotFound-CmT-Wr9m.js +39 -0
  134. package/dist/PageNotFound-CmT-Wr9m.js.map +1 -0
  135. package/dist/PageNotFound-CxLUFoJa.cjs +2 -0
  136. package/dist/PageNotFound-CxLUFoJa.cjs.map +1 -0
  137. package/dist/{Pagination-CN9V8M5C.js → Pagination-BuP4N1bj.js} +2 -2
  138. package/dist/{Pagination-CN9V8M5C.js.map → Pagination-BuP4N1bj.js.map} +1 -1
  139. package/dist/{Pagination-DRwTLPh8.cjs → Pagination-Dcs_Znx3.cjs} +2 -2
  140. package/dist/{Pagination-DRwTLPh8.cjs.map → Pagination-Dcs_Znx3.cjs.map} +1 -1
  141. package/dist/{RemoveDialog-ClyZKyUG.cjs → RemoveDialog-Cwtq9wAt.cjs} +2 -2
  142. package/dist/{RemoveDialog-ClyZKyUG.cjs.map → RemoveDialog-Cwtq9wAt.cjs.map} +1 -1
  143. package/dist/{RemoveDialog-Bvt6sH79.js → RemoveDialog-DU6MqkO8.js} +4 -4
  144. package/dist/{RemoveDialog-Bvt6sH79.js.map → RemoveDialog-DU6MqkO8.js.map} +1 -1
  145. package/dist/{RichTextEditor-CAYt1Zm1.cjs → RichTextEditor-GxbnzLRe.cjs} +2 -2
  146. package/dist/{RichTextEditor-CAYt1Zm1.cjs.map → RichTextEditor-GxbnzLRe.cjs.map} +1 -1
  147. package/dist/{RichTextEditor-BTx8Py3I.js → RichTextEditor-k-NlWb4Y.js} +9 -9
  148. package/dist/{RichTextEditor-BTx8Py3I.js.map → RichTextEditor-k-NlWb4Y.js.map} +1 -1
  149. package/dist/RootLayout-4GV6dfdB.cjs +2 -0
  150. package/dist/RootLayout-4GV6dfdB.cjs.map +1 -0
  151. package/dist/{RootLayout-DCpfuFWF.js → RootLayout-BPSWgWlI.js} +16 -16
  152. package/dist/RootLayout-BPSWgWlI.js.map +1 -0
  153. package/dist/{Select-PbTyxB1Q.js → Select-D7KJ-YMU.js} +5 -5
  154. package/dist/{Select-PbTyxB1Q.js.map → Select-D7KJ-YMU.js.map} +1 -1
  155. package/dist/{Select-_6WogC0u.cjs → Select-DjMZec8c.cjs} +2 -2
  156. package/dist/{Select-_6WogC0u.cjs.map → Select-DjMZec8c.cjs.map} +1 -1
  157. package/dist/{Sidebar-AaIlRzgk.cjs → Sidebar-CT_NUo_7.cjs} +2 -2
  158. package/dist/{Sidebar-AaIlRzgk.cjs.map → Sidebar-CT_NUo_7.cjs.map} +1 -1
  159. package/dist/{Sidebar-DRCs2ygZ.js → Sidebar-Csd3iKbS.js} +7 -5
  160. package/dist/{Sidebar-DRCs2ygZ.js.map → Sidebar-Csd3iKbS.js.map} +1 -1
  161. package/dist/{SpeedDial-C4jxIXTr.cjs → SpeedDial-CyiPagdu.cjs} +2 -2
  162. package/dist/{SpeedDial-C4jxIXTr.cjs.map → SpeedDial-CyiPagdu.cjs.map} +1 -1
  163. package/dist/{SpeedDial-DgFj16BQ.js → SpeedDial-DEWzAGXi.js} +2 -2
  164. package/dist/{SpeedDial-DgFj16BQ.js.map → SpeedDial-DEWzAGXi.js.map} +1 -1
  165. package/dist/{Stepper-COKAyN1L.js → Stepper-CS6s0dMF.js} +2 -2
  166. package/dist/{Stepper-COKAyN1L.js.map → Stepper-CS6s0dMF.js.map} +1 -1
  167. package/dist/{Stepper-7pPEBRLI.cjs → Stepper-PW7c45PV.cjs} +2 -2
  168. package/dist/{Stepper-7pPEBRLI.cjs.map → Stepper-PW7c45PV.cjs.map} +1 -1
  169. package/dist/{Table-BeOumGng.cjs → Table-C_Ov-kvK.cjs} +2 -2
  170. package/dist/{Table-BeOumGng.cjs.map → Table-C_Ov-kvK.cjs.map} +1 -1
  171. package/dist/{Table-BjPLvMbf.js → Table-IIAKXYOh.js} +174 -174
  172. package/dist/{Table-BjPLvMbf.js.map → Table-IIAKXYOh.js.map} +1 -1
  173. package/dist/{Tabs-BZcMnjdC.cjs → Tabs-CaHTJ99w.cjs} +2 -2
  174. package/dist/{Tabs-BZcMnjdC.cjs.map → Tabs-CaHTJ99w.cjs.map} +1 -1
  175. package/dist/{Tabs--DDM-zKe.js → Tabs-D3wztVB1.js} +2 -2
  176. package/dist/{Tabs--DDM-zKe.js.map → Tabs-D3wztVB1.js.map} +1 -1
  177. package/dist/{TagsField-kknWiJZZ.cjs → TagsField-BQIwSX5m.cjs} +2 -2
  178. package/dist/{TagsField-kknWiJZZ.cjs.map → TagsField-BQIwSX5m.cjs.map} +1 -1
  179. package/dist/{TagsField-BTJcZS9P.js → TagsField-BR9Z5pik.js} +4 -4
  180. package/dist/{TagsField-BTJcZS9P.js.map → TagsField-BR9Z5pik.js.map} +1 -1
  181. package/dist/{TextField-DMI1X09n.js → TextField-Bg4TwkVD.js} +3 -3
  182. package/dist/{TextField-DMI1X09n.js.map → TextField-Bg4TwkVD.js.map} +1 -1
  183. package/dist/{TextField-BPefnD5M.cjs → TextField-fmt7aacg.cjs} +2 -2
  184. package/dist/{TextField-BPefnD5M.cjs.map → TextField-fmt7aacg.cjs.map} +1 -1
  185. package/dist/{ThemeToggle-DTal3RX5.cjs → ThemeToggle-Cz5I2-DL.cjs} +2 -2
  186. package/dist/{ThemeToggle-DTal3RX5.cjs.map → ThemeToggle-Cz5I2-DL.cjs.map} +1 -1
  187. package/dist/{ThemeToggle-Deh9j8pm.js → ThemeToggle-DEfXczDs.js} +3 -3
  188. package/dist/{ThemeToggle-Deh9j8pm.js.map → ThemeToggle-DEfXczDs.js.map} +1 -1
  189. package/dist/{TimeColumns-BCNmu4b_.js → TimeColumns-B-vtakk8.js} +2 -2
  190. package/dist/{TimeColumns-BCNmu4b_.js.map → TimeColumns-B-vtakk8.js.map} +1 -1
  191. package/dist/{TimeColumns-Duh4DcYJ.cjs → TimeColumns-IBmjExao.cjs} +2 -2
  192. package/dist/{TimeColumns-Duh4DcYJ.cjs.map → TimeColumns-IBmjExao.cjs.map} +1 -1
  193. package/dist/{TimePicker-CfGrCH9T.cjs → TimePicker-B-c6uIaY.cjs} +2 -2
  194. package/dist/{TimePicker-CfGrCH9T.cjs.map → TimePicker-B-c6uIaY.cjs.map} +1 -1
  195. package/dist/{TimePicker-3JgvK2on.js → TimePicker-i2RnZHV1.js} +5 -5
  196. package/dist/{TimePicker-3JgvK2on.js.map → TimePicker-i2RnZHV1.js.map} +1 -1
  197. package/dist/{Toaster-D-eG1xv7.js → Toaster-Da8F_SFV.js} +2 -2
  198. package/dist/{Toaster-D-eG1xv7.js.map → Toaster-Da8F_SFV.js.map} +1 -1
  199. package/dist/{Toaster-Bk5GtPjX.cjs → Toaster-qdS8Urgy.cjs} +2 -2
  200. package/dist/{Toaster-Bk5GtPjX.cjs.map → Toaster-qdS8Urgy.cjs.map} +1 -1
  201. package/dist/TranslatedFields-C30ww45c.cjs +2 -0
  202. package/dist/TranslatedFields-C30ww45c.cjs.map +1 -0
  203. package/dist/TranslatedFields-Ck9JTF27.js +86 -0
  204. package/dist/TranslatedFields-Ck9JTF27.js.map +1 -0
  205. package/dist/{UserCard-BhqtX1vU.js → UserCard-0ZF29bkK.js} +3 -3
  206. package/dist/{UserCard-BhqtX1vU.js.map → UserCard-0ZF29bkK.js.map} +1 -1
  207. package/dist/{UserCard-OlLeyyS0.cjs → UserCard-C8rC_gzD.cjs} +2 -2
  208. package/dist/{UserCard-OlLeyyS0.cjs.map → UserCard-C8rC_gzD.cjs.map} +1 -1
  209. package/dist/breakpoints-BbDakdqF.js +50 -0
  210. package/dist/breakpoints-BbDakdqF.js.map +1 -0
  211. package/dist/breakpoints-Dpnh6BbG.cjs +2 -0
  212. package/dist/breakpoints-Dpnh6BbG.cjs.map +1 -0
  213. package/dist/components/Alert/index.cjs +1 -1
  214. package/dist/components/Alert/index.js +1 -1
  215. package/dist/components/Breadcrumbs/index.cjs +1 -1
  216. package/dist/components/Breadcrumbs/index.js +1 -1
  217. package/dist/components/Button/index.cjs +1 -1
  218. package/dist/components/Button/index.js +1 -1
  219. package/dist/components/Card/index.cjs +1 -1
  220. package/dist/components/Card/index.js +1 -1
  221. package/dist/components/Chip/index.cjs +1 -1
  222. package/dist/components/Chip/index.js +1 -1
  223. package/dist/components/CodeBlock/index.cjs +1 -1
  224. package/dist/components/CodeBlock/index.js +1 -1
  225. package/dist/components/ColorPicker/index.cjs +1 -1
  226. package/dist/components/ColorPicker/index.js +1 -1
  227. package/dist/components/CopyButton/CopyButton.d.cts +32 -0
  228. package/dist/components/CopyButton/CopyButton.d.ts +32 -0
  229. package/dist/components/CopyButton/index.cjs +2 -0
  230. package/dist/components/CopyButton/index.cjs.map +1 -0
  231. package/dist/components/CopyButton/index.d.cts +2 -0
  232. package/dist/components/CopyButton/index.d.ts +2 -0
  233. package/dist/components/CopyButton/index.js +6 -0
  234. package/dist/components/CopyButton/index.js.map +1 -0
  235. package/dist/components/DashedButton/DashedButton.d.cts +33 -0
  236. package/dist/components/DashedButton/DashedButton.d.ts +33 -0
  237. package/dist/components/DashedButton/index.cjs +2 -0
  238. package/dist/components/DashedButton/index.cjs.map +1 -0
  239. package/dist/components/DashedButton/index.d.cts +2 -0
  240. package/dist/components/DashedButton/index.d.ts +2 -0
  241. package/dist/components/DashedButton/index.js +6 -0
  242. package/dist/components/DashedButton/index.js.map +1 -0
  243. package/dist/components/DatePicker/index.cjs +1 -1
  244. package/dist/components/DatePicker/index.js +1 -1
  245. package/dist/components/DateTimePicker/index.cjs +1 -1
  246. package/dist/components/DateTimePicker/index.js +1 -1
  247. package/dist/components/Dropdown/index.cjs +1 -1
  248. package/dist/components/Dropdown/index.js +1 -1
  249. package/dist/components/EmptyState/index.cjs +1 -1
  250. package/dist/components/EmptyState/index.js +1 -1
  251. package/dist/components/FileCard/FileCard.d.cts +45 -0
  252. package/dist/components/FileCard/FileCard.d.ts +45 -0
  253. package/dist/components/FileCard/index.cjs +2 -0
  254. package/dist/components/FileCard/index.cjs.map +1 -0
  255. package/dist/components/FileCard/index.d.cts +2 -0
  256. package/dist/components/FileCard/index.d.ts +2 -0
  257. package/dist/components/FileCard/index.js +6 -0
  258. package/dist/components/FileCard/index.js.map +1 -0
  259. package/dist/components/FileUploader/index.cjs +1 -1
  260. package/dist/components/FileUploader/index.js +1 -1
  261. package/dist/components/Flag/index.cjs +1 -1
  262. package/dist/components/Flag/index.js +1 -1
  263. package/dist/components/Flex/Flex.d.cts +16 -13
  264. package/dist/components/Flex/Flex.d.ts +16 -13
  265. package/dist/components/Flex/Grid.d.cts +11 -9
  266. package/dist/components/Flex/Grid.d.ts +11 -9
  267. package/dist/components/Flex/index.cjs +1 -1
  268. package/dist/components/Flex/index.js +3 -3
  269. package/dist/components/FullscreenToggle/index.cjs +1 -1
  270. package/dist/components/FullscreenToggle/index.js +1 -1
  271. package/dist/components/IconButton/index.cjs +1 -1
  272. package/dist/components/IconButton/index.js +1 -1
  273. package/dist/components/List/index.cjs +1 -1
  274. package/dist/components/List/index.js +2 -2
  275. package/dist/components/Loader/index.cjs +1 -1
  276. package/dist/components/Loader/index.js +1 -1
  277. package/dist/components/Masonry/Masonry.d.cts +22 -15
  278. package/dist/components/Masonry/Masonry.d.ts +22 -15
  279. package/dist/components/Masonry/index.cjs +1 -1
  280. package/dist/components/Masonry/index.js +1 -1
  281. package/dist/components/Modal/index.cjs +1 -1
  282. package/dist/components/Modal/index.js +1 -1
  283. package/dist/components/MultiSelect/index.cjs +1 -1
  284. package/dist/components/MultiSelect/index.js +1 -1
  285. package/dist/components/NumberField/index.cjs +1 -1
  286. package/dist/components/NumberField/index.js +1 -1
  287. package/dist/components/OtpField/index.cjs +1 -1
  288. package/dist/components/OtpField/index.js +1 -1
  289. package/dist/components/PageLayout/index.cjs +1 -1
  290. package/dist/components/PageLayout/index.js +1 -1
  291. package/dist/components/PageNotFound/PageNotFound.d.cts +34 -0
  292. package/dist/components/PageNotFound/PageNotFound.d.ts +34 -0
  293. package/dist/components/PageNotFound/index.cjs +2 -0
  294. package/dist/components/PageNotFound/index.cjs.map +1 -0
  295. package/dist/components/PageNotFound/index.d.cts +2 -0
  296. package/dist/components/PageNotFound/index.d.ts +2 -0
  297. package/dist/components/PageNotFound/index.js +6 -0
  298. package/dist/components/PageNotFound/index.js.map +1 -0
  299. package/dist/components/Pagination/index.cjs +1 -1
  300. package/dist/components/Pagination/index.js +1 -1
  301. package/dist/components/RemoveDialog/index.cjs +1 -1
  302. package/dist/components/RemoveDialog/index.js +1 -1
  303. package/dist/components/RichTextEditor/index.cjs +1 -1
  304. package/dist/components/RichTextEditor/index.js +1 -1
  305. package/dist/components/RootLayout/index.cjs +1 -1
  306. package/dist/components/RootLayout/index.js +1 -1
  307. package/dist/components/Select/index.cjs +1 -1
  308. package/dist/components/Select/index.js +1 -1
  309. package/dist/components/Sidebar/index.cjs +1 -1
  310. package/dist/components/Sidebar/index.js +1 -1
  311. package/dist/components/SpeedDial/index.cjs +1 -1
  312. package/dist/components/SpeedDial/index.js +1 -1
  313. package/dist/components/Stepper/index.cjs +1 -1
  314. package/dist/components/Stepper/index.js +1 -1
  315. package/dist/components/Table/index.cjs +1 -1
  316. package/dist/components/Table/index.js +1 -1
  317. package/dist/components/Tabs/index.cjs +1 -1
  318. package/dist/components/Tabs/index.js +1 -1
  319. package/dist/components/TagsField/index.cjs +1 -1
  320. package/dist/components/TagsField/index.js +1 -1
  321. package/dist/components/TextField/index.cjs +1 -1
  322. package/dist/components/TextField/index.js +1 -1
  323. package/dist/components/ThemeToggle/index.cjs +1 -1
  324. package/dist/components/ThemeToggle/index.js +1 -1
  325. package/dist/components/TimePicker/index.cjs +1 -1
  326. package/dist/components/TimePicker/index.js +1 -1
  327. package/dist/components/Toast/index.cjs +1 -1
  328. package/dist/components/Toast/index.js +1 -1
  329. package/dist/components/TranslatedFields/TranslatedFields.d.cts +9 -2
  330. package/dist/components/TranslatedFields/TranslatedFields.d.ts +9 -2
  331. package/dist/components/TranslatedFields/index.cjs +1 -1
  332. package/dist/components/TranslatedFields/index.js +1 -1
  333. package/dist/components/UserCard/index.cjs +1 -1
  334. package/dist/components/UserCard/index.js +1 -1
  335. package/dist/components/index.d.cts +4 -0
  336. package/dist/components/index.d.ts +4 -0
  337. package/dist/entries/components.cjs +1 -1
  338. package/dist/entries/components.js +135 -127
  339. package/dist/entries/components.js.map +1 -1
  340. package/dist/entries/hooks.cjs +1 -1
  341. package/dist/entries/hooks.d.cts +3 -1
  342. package/dist/entries/hooks.d.ts +3 -1
  343. package/dist/entries/hooks.js +7 -4
  344. package/dist/entries/hooks.js.map +1 -1
  345. package/dist/entries/i18n.cjs +1 -1
  346. package/dist/entries/i18n.js +2 -2
  347. package/dist/entries/theme.cjs +1 -1
  348. package/dist/entries/theme.d.cts +2 -2
  349. package/dist/entries/theme.d.ts +2 -2
  350. package/dist/entries/theme.js +16 -14
  351. package/dist/hooks/index.d.cts +3 -1
  352. package/dist/hooks/index.d.ts +3 -1
  353. package/dist/hooks/useClipboard.d.cts +28 -0
  354. package/dist/hooks/useClipboard.d.ts +28 -0
  355. package/dist/hooks/useMediaQuery.d.cts +21 -8
  356. package/dist/hooks/useMediaQuery.d.ts +21 -8
  357. package/dist/i18n/messages.d.cts +6 -0
  358. package/dist/i18n/messages.d.ts +6 -0
  359. package/dist/index.cjs +1 -1
  360. package/dist/index.css +1 -1
  361. package/dist/index.js +197 -184
  362. package/dist/index.js.map +1 -1
  363. package/dist/{messages-C-zecFBE.js → messages-BOKick2l.js} +52 -10
  364. package/dist/messages-BOKick2l.js.map +1 -0
  365. package/dist/messages-Jxz2YMcA.cjs +36 -0
  366. package/dist/messages-Jxz2YMcA.cjs.map +1 -0
  367. package/dist/theme/ConfigProvider.d.cts +9 -0
  368. package/dist/theme/ConfigProvider.d.ts +9 -0
  369. package/dist/theme/breakpoints.d.cts +48 -13
  370. package/dist/theme/breakpoints.d.ts +48 -13
  371. package/dist/theme/index.d.cts +2 -2
  372. package/dist/theme/index.d.ts +2 -2
  373. package/dist/useClipboard-BjTIX-4g.cjs +2 -0
  374. package/dist/useClipboard-BjTIX-4g.cjs.map +1 -0
  375. package/dist/useClipboard-CEw_Juiq.js +23 -0
  376. package/dist/useClipboard-CEw_Juiq.js.map +1 -0
  377. package/dist/useMediaQuery-CHMrI6Dy.cjs +2 -0
  378. package/dist/useMediaQuery-CHMrI6Dy.cjs.map +1 -0
  379. package/dist/useMediaQuery-DrDUrkmJ.js +32 -0
  380. package/dist/useMediaQuery-DrDUrkmJ.js.map +1 -0
  381. package/package.json +4 -3
  382. package/dist/ConfigProvider-2c94kUOk.js +0 -291
  383. package/dist/ConfigProvider-2c94kUOk.js.map +0 -1
  384. package/dist/ConfigProvider-ByOFXVyP.cjs +0 -2
  385. package/dist/ConfigProvider-ByOFXVyP.cjs.map +0 -1
  386. package/dist/Flex-Bj3mMF5A.js +0 -50
  387. package/dist/Flex-Bj3mMF5A.js.map +0 -1
  388. package/dist/Flex-CqL3Ghda.cjs +0 -2
  389. package/dist/Flex-CqL3Ghda.cjs.map +0 -1
  390. package/dist/Grid-Bw95bKkJ.cjs +0 -2
  391. package/dist/Grid-Bw95bKkJ.cjs.map +0 -1
  392. package/dist/Grid-CY-syhTX.js +0 -24
  393. package/dist/Grid-CY-syhTX.js.map +0 -1
  394. package/dist/Masonry-BTvtDdnt.js +0 -104
  395. package/dist/Masonry-BTvtDdnt.js.map +0 -1
  396. package/dist/Masonry-Bl1Mlzqw.cjs +0 -2
  397. package/dist/Masonry-Bl1Mlzqw.cjs.map +0 -1
  398. package/dist/RootLayout-Cp-9CVjP.cjs +0 -2
  399. package/dist/RootLayout-Cp-9CVjP.cjs.map +0 -1
  400. package/dist/RootLayout-DCpfuFWF.js.map +0 -1
  401. package/dist/TranslatedFields-CI0F9bHw.js +0 -82
  402. package/dist/TranslatedFields-CI0F9bHw.js.map +0 -1
  403. package/dist/TranslatedFields-DT3bYse6.cjs +0 -2
  404. package/dist/TranslatedFields-DT3bYse6.cjs.map +0 -1
  405. package/dist/breakpoints-BNPC2_Te.cjs +0 -2
  406. package/dist/breakpoints-BNPC2_Te.cjs.map +0 -1
  407. package/dist/breakpoints-o3dzSzrU.js +0 -12
  408. package/dist/breakpoints-o3dzSzrU.js.map +0 -1
  409. package/dist/messages-C-zecFBE.js.map +0 -1
  410. package/dist/messages-Cy-qK5xU.cjs +0 -36
  411. package/dist/messages-Cy-qK5xU.cjs.map +0 -1
  412. package/dist/useMediaQuery-BCsNfMA1.cjs +0 -2
  413. package/dist/useMediaQuery-BCsNfMA1.cjs.map +0 -1
  414. package/dist/useMediaQuery-_1EcFoC5.js +0 -17
  415. package/dist/useMediaQuery-_1EcFoC5.js.map +0 -1
@@ -2,7 +2,7 @@ import { jsxs as et, Fragment as nt, jsx as q } from "react/jsx-runtime";
2
2
  import { useId as ot, useRef as z, useState as R, useCallback as M, useLayoutEffect as rt, useEffect as W, cloneElement as it } from "react";
3
3
  import { createPortal as st } from "react-dom";
4
4
  import { clsx as ct } from "clsx";
5
- import { L as at } from "./List-BHgFI9Ll.js";
5
+ import { L as at } from "./List-LqbfF6gU.js";
6
6
  import { u as lt } from "./useLockBodyScroll-DwBILLPK.js";
7
7
  const ut = "_panel_ntp6g_4", dt = "_sm_ntp6g_21", mt = "_md_ntp6g_24", ft = "_lg_ntp6g_27", C = {
8
8
  panel: ut,
@@ -143,4 +143,4 @@ function Et({
143
143
  export {
144
144
  Et as D
145
145
  };
146
- //# sourceMappingURL=Dropdown-DKAXue5_.js.map
146
+ //# sourceMappingURL=Dropdown-FfkmluRu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dropdown-DKAXue5_.js","sources":["../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import {\n cloneElement,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type MouseEvent as ReactMouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport { clsx } from 'clsx'\nimport { List, type ListItemSize } from '../List'\nimport { useLockBodyScroll } from '../../hooks/useLockBodyScroll'\nimport styles from './Dropdown.module.css'\n\nexport type DropdownPlacement = 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end'\n\ninterface Position {\n top: number\n left: number\n side: 'top' | 'bottom'\n maxHeight: number\n minWidth?: number\n}\n\nexport interface DropdownProps {\n /** The element that opens the menu (e.g. a `Button` / `IconButton`). Cloned to wire click + a11y. */\n trigger: ReactElement\n /** Menu content — typically `ListItem`s (composed inside a `role=\"menu\"` `List`). */\n children: ReactNode\n /** Preferred placement. Flips to the opposite side automatically when it would overflow. Default `bottom-start`. */\n placement?: DropdownPlacement\n /** Menu size — sets the panel min-width (`sm` 150 · `md` 190 · `lg` 220) and the items' density. Default `md`. */\n size?: ListItemSize\n /**\n * Apply the size-based min-width (`sm` 150 · `md` 190 · `lg` 220px). Defaults to `true`; set `false`\n * to let the menu size to its content instead (the items' density still tracks `size`).\n */\n minWidth?: boolean\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Close the menu when an item inside is clicked. Defaults to `true`. */\n closeOnSelect?: boolean\n /** Make the menu at least as wide as the trigger (select-like). Defaults to `false`. */\n matchTriggerWidth?: boolean\n /** Prevents opening. */\n disabled?: boolean\n /** Gap between the trigger and the menu, in px. Defaults to `6`. */\n offset?: number\n /** Class applied to the floating panel. */\n className?: string\n /** Style applied to the floating panel. */\n style?: CSSProperties\n}\n\n/** Distance the menu is kept from the viewport edges (px). */\nconst VIEWPORT_PADDING = 8\n/** Focusable menu items, used for arrow-key roving. */\nconst FOCUSABLE =\n '[role=\"menuitem\"],[role=\"button\"],a[href],button:not([disabled]),[tabindex]:not([tabindex=\"-1\"])'\n\nfunction focusableItems(panel: HTMLElement | null): HTMLElement[] {\n if (!panel) return []\n return Array.from(panel.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n (el) => el.getAttribute('aria-disabled') !== 'true' && el.offsetParent !== null,\n )\n}\n\n/**\n * A floating menu anchored to a `trigger`. Opens on trigger click; closes on outside click, `Escape`,\n * or selecting an item. The panel is portaled to `document.body` and positioned with collision\n * handling — it **flips** to the opposite side when it would overflow, clamps within the viewport, and\n * re-positions on scroll/resize (a too-tall menu caps its height and scrolls). Arrow keys move between\n * items; `Escape` returns focus to the trigger. Compose `ListItem`s as `children`.\n */\nexport function Dropdown({\n trigger,\n children,\n placement = 'bottom-start',\n size = 'md',\n minWidth = true,\n open,\n defaultOpen = false,\n onOpenChange,\n closeOnSelect = true,\n matchTriggerWidth = false,\n disabled = false,\n offset = 6,\n className,\n style,\n}: DropdownProps) {\n const menuId = useId()\n const triggerRef = useRef<HTMLElement | null>(null)\n const panelRef = useRef<HTMLDivElement | null>(null)\n\n const isControlled = open !== undefined\n const [internalOpen, setInternalOpen] = useState(defaultOpen)\n const isOpen = isControlled ? open : internalOpen\n const [visible, setVisible] = useState(false)\n const [pos, setPos] = useState<Position | null>(null)\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) setInternalOpen(next)\n onOpenChange?.(next)\n },\n [isControlled, onOpenChange],\n )\n const close = useCallback(() => setOpen(false), [setOpen])\n\n // lock page scroll while the menu is open (no scrollbar shift)\n useLockBodyScroll(isOpen)\n\n // ── positioning: flip when it would overflow, clamp inside the viewport ──\n const update = useCallback(() => {\n const triggerEl = triggerRef.current\n const panel = panelRef.current\n if (!triggerEl || !panel) return\n\n const rect = triggerEl.getBoundingClientRect()\n const panelW = panel.offsetWidth\n const panelH = panel.offsetHeight\n const vw = window.innerWidth\n const vh = window.innerHeight\n const pad = VIEWPORT_PADDING\n\n const spaceBelow = vh - rect.bottom - offset - pad\n const spaceAbove = rect.top - offset - pad\n let side: 'top' | 'bottom' = placement.startsWith('bottom') ? 'bottom' : 'top'\n // flip only when the preferred side can't fit AND the opposite side has more room\n if (side === 'bottom' && panelH > spaceBelow && spaceAbove > spaceBelow) side = 'top'\n else if (side === 'top' && panelH > spaceAbove && spaceBelow > spaceAbove) side = 'bottom'\n\n const available = side === 'bottom' ? spaceBelow : spaceAbove\n const maxHeight = Math.max(0, available)\n const usedH = Math.min(panelH, maxHeight)\n\n let top = side === 'bottom' ? rect.bottom + offset : rect.top - offset - usedH\n top = Math.min(Math.max(top, pad), Math.max(pad, vh - pad - usedH))\n\n let left = placement.endsWith('end') ? rect.right - panelW : rect.left\n left = Math.min(Math.max(left, pad), Math.max(pad, vw - pad - panelW))\n\n setPos({ top, left, side, maxHeight, minWidth: matchTriggerWidth ? rect.width : undefined })\n }, [placement, offset, matchTriggerWidth])\n\n // position synchronously before paint whenever the menu is open\n useLayoutEffect(() => {\n if (!isOpen) {\n setVisible(false)\n return\n }\n update()\n }, [isOpen, update])\n\n // enter transition + reposition listeners while open\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => setVisible(true))\n\n const onReposition = () => update()\n window.addEventListener('resize', onReposition)\n window.addEventListener('scroll', onReposition, true)\n let ro: ResizeObserver | undefined\n if (typeof ResizeObserver !== 'undefined') {\n ro = new ResizeObserver(onReposition)\n if (panelRef.current) ro.observe(panelRef.current)\n if (triggerRef.current) ro.observe(triggerRef.current)\n }\n\n return () => {\n cancelAnimationFrame(raf)\n window.removeEventListener('resize', onReposition)\n window.removeEventListener('scroll', onReposition, true)\n ro?.disconnect()\n }\n }, [isOpen, update])\n\n // outside click + keyboard (Escape, arrow roving)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node\n if (triggerRef.current?.contains(target) || panelRef.current?.contains(target)) return\n close()\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault()\n close()\n triggerRef.current?.focus()\n } else if (event.key === 'Tab') {\n // Tab would move focus by portal DOM order (end of <body>), orphaning the open menu — close it\n // and let focus continue naturally from the trigger (Select/MultiSelect do the same)\n close()\n } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n const items = focusableItems(panelRef.current)\n if (!items.length) return\n const current = items.indexOf(document.activeElement as HTMLElement)\n const delta = event.key === 'ArrowDown' ? 1 : -1\n const next = (current + delta + items.length) % items.length\n items[next]?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen, close])\n\n // focus the first item once the menu is open and positioned\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => focusableItems(panelRef.current)[0]?.focus())\n return () => cancelAnimationFrame(raf)\n }, [isOpen])\n\n const triggerProps = trigger.props as {\n onClick?: (event: ReactMouseEvent) => void\n ref?: Ref<HTMLElement>\n }\n const originalRef = triggerProps.ref\n\n const clonedTrigger = cloneElement(trigger as ReactElement<Record<string, unknown>>, {\n ref: (node: HTMLElement | null) => {\n triggerRef.current = node\n if (typeof originalRef === 'function') originalRef(node)\n else if (originalRef) (originalRef as { current: HTMLElement | null }).current = node\n },\n onClick: (event: ReactMouseEvent) => {\n triggerProps.onClick?.(event)\n if (!disabled) setOpen(!isOpen)\n },\n 'aria-haspopup': 'menu',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? menuId : undefined,\n })\n\n const handlePanelClick = (event: ReactMouseEvent) => {\n if (!closeOnSelect) return\n const item = (event.target as HTMLElement).closest(FOCUSABLE)\n if (item && item.getAttribute('aria-disabled') !== 'true') {\n close()\n triggerRef.current?.focus()\n }\n }\n\n return (\n <>\n {clonedTrigger}\n {isOpen &&\n createPortal(\n <div\n ref={panelRef}\n id={menuId}\n className={clsx(styles.panel, minWidth && styles[size], className)}\n data-open={visible ? 'true' : 'false'}\n data-side={pos?.side ?? 'bottom'}\n style={{\n position: 'fixed',\n top: pos?.top ?? 0,\n left: pos?.left ?? 0,\n maxHeight: pos?.maxHeight,\n minWidth: pos?.minWidth,\n visibility: pos ? 'visible' : 'hidden',\n ...style,\n }}\n onClick={handlePanelClick}\n >\n <List role=\"menu\" size={size} padding=\"xs\">\n {children}\n </List>\n </div>,\n document.body,\n )}\n </>\n )\n}\n"],"names":["VIEWPORT_PADDING","FOCUSABLE","focusableItems","panel","el","Dropdown","trigger","children","placement","size","minWidth","open","defaultOpen","onOpenChange","closeOnSelect","matchTriggerWidth","disabled","offset","className","style","menuId","useId","triggerRef","useRef","panelRef","isControlled","internalOpen","setInternalOpen","useState","isOpen","visible","setVisible","pos","setPos","setOpen","useCallback","next","close","useLockBodyScroll","update","triggerEl","rect","panelW","panelH","vw","vh","pad","spaceBelow","spaceAbove","side","maxHeight","usedH","top","left","useLayoutEffect","useEffect","raf","onReposition","ro","onPointerDown","event","target","_a","_b","onKeyDown","items","current","delta","triggerProps","originalRef","clonedTrigger","cloneElement","node","handlePanelClick","item","jsxs","Fragment","createPortal","jsx","clsx","styles","List"],"mappings":";;;;;;;;;;;GAiEMA,KAAmB,GAEnBC,IACJ;AAEF,SAASC,EAAeC,GAA0C;AAChE,SAAKA,IACE,MAAM,KAAKA,EAAM,iBAA8BF,CAAS,CAAC,EAAE;AAAA,IAChE,CAACG,MAAOA,EAAG,aAAa,eAAe,MAAM,UAAUA,EAAG,iBAAiB;AAAA,EAAA,IAF1D,CAAA;AAIrB;AASO,SAASC,GAAS;AAAA,EACvB,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,MAAAC,IAAO;AAAA,EACP,UAAAC,IAAW;AAAA,EACX,MAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,cAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,mBAAAC,IAAoB;AAAA,EACpB,UAAAC,IAAW;AAAA,EACX,QAAAC,IAAS;AAAA,EACT,WAAAC;AAAA,EACA,OAAAC;AACF,GA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UAAA;AAAA,UAEL,SAASsD;AAAA,UAET,4BAACQ,IAAA,EAAK,MAAK,QAAO,MAAAxE,GAAY,SAAQ,MACnC,UAAAF,EAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,MAEF,SAAS;AAAA,IAAA;AAAA,EACX,GACJ;AAEJ;"}
1
+ {"version":3,"file":"Dropdown-FfkmluRu.js","sources":["../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import {\n cloneElement,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type MouseEvent as ReactMouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport { clsx } from 'clsx'\nimport { List, type ListItemSize } from '../List'\nimport { useLockBodyScroll } from '../../hooks/useLockBodyScroll'\nimport styles from './Dropdown.module.css'\n\nexport type DropdownPlacement = 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end'\n\ninterface Position {\n top: number\n left: number\n side: 'top' | 'bottom'\n maxHeight: number\n minWidth?: number\n}\n\nexport interface DropdownProps {\n /** The element that opens the menu (e.g. a `Button` / `IconButton`). Cloned to wire click + a11y. */\n trigger: ReactElement\n /** Menu content — typically `ListItem`s (composed inside a `role=\"menu\"` `List`). */\n children: ReactNode\n /** Preferred placement. Flips to the opposite side automatically when it would overflow. Default `bottom-start`. */\n placement?: DropdownPlacement\n /** Menu size — sets the panel min-width (`sm` 150 · `md` 190 · `lg` 220) and the items' density. Default `md`. */\n size?: ListItemSize\n /**\n * Apply the size-based min-width (`sm` 150 · `md` 190 · `lg` 220px). Defaults to `true`; set `false`\n * to let the menu size to its content instead (the items' density still tracks `size`).\n */\n minWidth?: boolean\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Close the menu when an item inside is clicked. Defaults to `true`. */\n closeOnSelect?: boolean\n /** Make the menu at least as wide as the trigger (select-like). Defaults to `false`. */\n matchTriggerWidth?: boolean\n /** Prevents opening. */\n disabled?: boolean\n /** Gap between the trigger and the menu, in px. Defaults to `6`. */\n offset?: number\n /** Class applied to the floating panel. */\n className?: string\n /** Style applied to the floating panel. */\n style?: CSSProperties\n}\n\n/** Distance the menu is kept from the viewport edges (px). */\nconst VIEWPORT_PADDING = 8\n/** Focusable menu items, used for arrow-key roving. */\nconst FOCUSABLE =\n '[role=\"menuitem\"],[role=\"button\"],a[href],button:not([disabled]),[tabindex]:not([tabindex=\"-1\"])'\n\nfunction focusableItems(panel: HTMLElement | null): HTMLElement[] {\n if (!panel) return []\n return Array.from(panel.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n (el) => el.getAttribute('aria-disabled') !== 'true' && el.offsetParent !== null,\n )\n}\n\n/**\n * A floating menu anchored to a `trigger`. Opens on trigger click; closes on outside click, `Escape`,\n * or selecting an item. The panel is portaled to `document.body` and positioned with collision\n * handling — it **flips** to the opposite side when it would overflow, clamps within the viewport, and\n * re-positions on scroll/resize (a too-tall menu caps its height and scrolls). Arrow keys move between\n * items; `Escape` returns focus to the trigger. Compose `ListItem`s as `children`.\n */\nexport function Dropdown({\n trigger,\n children,\n placement = 'bottom-start',\n size = 'md',\n minWidth = true,\n open,\n defaultOpen = false,\n onOpenChange,\n closeOnSelect = true,\n matchTriggerWidth = false,\n disabled = false,\n offset = 6,\n className,\n style,\n}: DropdownProps) {\n const menuId = useId()\n const triggerRef = useRef<HTMLElement | null>(null)\n const panelRef = useRef<HTMLDivElement | null>(null)\n\n const isControlled = open !== undefined\n const [internalOpen, setInternalOpen] = useState(defaultOpen)\n const isOpen = isControlled ? open : internalOpen\n const [visible, setVisible] = useState(false)\n const [pos, setPos] = useState<Position | null>(null)\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) setInternalOpen(next)\n onOpenChange?.(next)\n },\n [isControlled, onOpenChange],\n )\n const close = useCallback(() => setOpen(false), [setOpen])\n\n // lock page scroll while the menu is open (no scrollbar shift)\n useLockBodyScroll(isOpen)\n\n // ── positioning: flip when it would overflow, clamp inside the viewport ──\n const update = useCallback(() => {\n const triggerEl = triggerRef.current\n const panel = panelRef.current\n if (!triggerEl || !panel) return\n\n const rect = triggerEl.getBoundingClientRect()\n const panelW = panel.offsetWidth\n const panelH = panel.offsetHeight\n const vw = window.innerWidth\n const vh = window.innerHeight\n const pad = VIEWPORT_PADDING\n\n const spaceBelow = vh - rect.bottom - offset - pad\n const spaceAbove = rect.top - offset - pad\n let side: 'top' | 'bottom' = placement.startsWith('bottom') ? 'bottom' : 'top'\n // flip only when the preferred side can't fit AND the opposite side has more room\n if (side === 'bottom' && panelH > spaceBelow && spaceAbove > spaceBelow) side = 'top'\n else if (side === 'top' && panelH > spaceAbove && spaceBelow > spaceAbove) side = 'bottom'\n\n const available = side === 'bottom' ? spaceBelow : spaceAbove\n const maxHeight = Math.max(0, available)\n const usedH = Math.min(panelH, maxHeight)\n\n let top = side === 'bottom' ? rect.bottom + offset : rect.top - offset - usedH\n top = Math.min(Math.max(top, pad), Math.max(pad, vh - pad - usedH))\n\n let left = placement.endsWith('end') ? rect.right - panelW : rect.left\n left = Math.min(Math.max(left, pad), Math.max(pad, vw - pad - panelW))\n\n setPos({ top, left, side, maxHeight, minWidth: matchTriggerWidth ? rect.width : undefined })\n }, [placement, offset, matchTriggerWidth])\n\n // position synchronously before paint whenever the menu is open\n useLayoutEffect(() => {\n if (!isOpen) {\n setVisible(false)\n return\n }\n update()\n }, [isOpen, update])\n\n // enter transition + reposition listeners while open\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => setVisible(true))\n\n const onReposition = () => update()\n window.addEventListener('resize', onReposition)\n window.addEventListener('scroll', onReposition, true)\n let ro: ResizeObserver | undefined\n if (typeof ResizeObserver !== 'undefined') {\n ro = new ResizeObserver(onReposition)\n if (panelRef.current) ro.observe(panelRef.current)\n if (triggerRef.current) ro.observe(triggerRef.current)\n }\n\n return () => {\n cancelAnimationFrame(raf)\n window.removeEventListener('resize', onReposition)\n window.removeEventListener('scroll', onReposition, true)\n ro?.disconnect()\n }\n }, [isOpen, update])\n\n // outside click + keyboard (Escape, arrow roving)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node\n if (triggerRef.current?.contains(target) || panelRef.current?.contains(target)) return\n close()\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault()\n close()\n triggerRef.current?.focus()\n } else if (event.key === 'Tab') {\n // Tab would move focus by portal DOM order (end of <body>), orphaning the open menu — close it\n // and let focus continue naturally from the trigger (Select/MultiSelect do the same)\n close()\n } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n const items = focusableItems(panelRef.current)\n if (!items.length) return\n const current = items.indexOf(document.activeElement as HTMLElement)\n const delta = event.key === 'ArrowDown' ? 1 : -1\n const next = (current + delta + items.length) % items.length\n items[next]?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen, close])\n\n // focus the first item once the menu is open and positioned\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => focusableItems(panelRef.current)[0]?.focus())\n return () => cancelAnimationFrame(raf)\n }, [isOpen])\n\n const triggerProps = trigger.props as {\n onClick?: (event: ReactMouseEvent) => void\n ref?: Ref<HTMLElement>\n }\n const originalRef = triggerProps.ref\n\n const clonedTrigger = cloneElement(trigger as ReactElement<Record<string, unknown>>, {\n ref: (node: HTMLElement | null) => {\n triggerRef.current = node\n if (typeof originalRef === 'function') originalRef(node)\n else if (originalRef) (originalRef as { current: HTMLElement | null }).current = node\n },\n onClick: (event: ReactMouseEvent) => {\n triggerProps.onClick?.(event)\n if (!disabled) setOpen(!isOpen)\n },\n 'aria-haspopup': 'menu',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? menuId : undefined,\n })\n\n const handlePanelClick = (event: ReactMouseEvent) => {\n if (!closeOnSelect) return\n const item = (event.target as HTMLElement).closest(FOCUSABLE)\n if (item && item.getAttribute('aria-disabled') !== 'true') {\n close()\n triggerRef.current?.focus()\n }\n }\n\n return (\n <>\n {clonedTrigger}\n {isOpen &&\n createPortal(\n <div\n ref={panelRef}\n id={menuId}\n className={clsx(styles.panel, minWidth && styles[size], className)}\n data-open={visible ? 'true' : 'false'}\n data-side={pos?.side ?? 'bottom'}\n style={{\n position: 'fixed',\n top: pos?.top ?? 0,\n left: pos?.left ?? 0,\n maxHeight: pos?.maxHeight,\n minWidth: pos?.minWidth,\n visibility: pos ? 'visible' : 'hidden',\n ...style,\n }}\n onClick={handlePanelClick}\n >\n <List role=\"menu\" size={size} padding=\"xs\">\n {children}\n </List>\n </div>,\n document.body,\n )}\n </>\n )\n}\n"],"names":["VIEWPORT_PADDING","FOCUSABLE","focusableItems","panel","el","Dropdown","trigger","children","placement","size","minWidth","open","defaultOpen","onOpenChange","closeOnSelect","matchTriggerWidth","disabled","offset","className","style","menuId","useId","triggerRef","useRef","panelRef","isControlled","internalOpen","setInternalOpen","useState","isOpen","visible","setVisible","pos","setPos","setOpen","useCallback","next","close","useLockBodyScroll","update","triggerEl","rect","panelW","panelH","vw","vh","pad","spaceBelow","spaceAbove","side","maxHeight","usedH","top","left","useLayoutEffect","useEffect","raf","onReposition","ro","onPointerDown","event","target","_a","_b","onKeyDown","items","current","delta","triggerProps","originalRef","clonedTrigger","cloneElement","node","handlePanelClick","item","jsxs","Fragment","createPortal","jsx","clsx","styles","List"],"mappings":";;;;;;;;;;;GAiEMA,KAAmB,GAEnBC,IACJ;AAEF,SAASC,EAAeC,GAA0C;AAChE,SAAKA,IACE,MAAM,KAAKA,EAAM,iBAA8BF,CAAS,CAAC,EAAE;AAAA,IAChE,CAACG,MAAOA,EAAG,aAAa,eAAe,MAAM,UA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AAOtE,KAAYsE,EAAOvE,CAAI,GAAGS,CAAS;AAAA,UACjE,aAAWY,IAAU,SAAS;AAAA,UAC9B,cAAWE,KAAA,gBAAAA,EAAK,SAAQ;AAAA,UACxB,OAAO;AAAA,YACL,UAAU;AAAA,YACV,MAAKA,KAAA,gBAAAA,EAAK,QAAO;AAAA,YACjB,OAAMA,KAAA,gBAAAA,EAAK,SAAQ;AAAA,YACnB,WAAWA,KAAA,gBAAAA,EAAK;AAAA,YAChB,UAAUA,KAAA,gBAAAA,EAAK;AAAA,YACf,YAAYA,IAAM,YAAY;AAAA,YAC9B,GAAGb;AAAA,UAAA;AAAA,UAEL,SAASsD;AAAA,UAET,4BAACQ,IAAA,EAAK,MAAK,QAAO,MAAAxE,GAAY,SAAQ,MACnC,UAAAF,EAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,MAEF,SAAS;AAAA,IAAA;AAAA,EACX,GACJ;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";const A=require("react/jsx-runtime"),o=require("react"),Z=require("react-dom"),$=require("clsx"),ee=require("./List-CNz2M3-q.cjs"),te=require("./useLockBodyScroll-CIXHZo-Q.cjs"),ne="_panel_ntp6g_4",re="_sm_ntp6g_21",oe="_md_ntp6g_24",se="_lg_ntp6g_27",B={panel:ne,sm:re,md:oe,lg:se},ie=8,j='[role="menuitem"],[role="button"],a[href],button:not([disabled]),[tabindex]:not([tabindex="-1"])';function C(b){return b?Array.from(b.querySelectorAll(j)).filter(h=>h.getAttribute("aria-disabled")!=="true"&&h.offsetParent!==null):[]}function ce({trigger:b,children:h,placement:L="bottom-start",size:M="md",minWidth:O=!0,open:W,defaultOpen:z=!1,onOpenChange:v,closeOnSelect:N=!0,matchTriggerWidth:H=!1,disabled:T=!1,offset:p=6,className:U,style:V}){const S=o.useId(),u=o.useRef(null),d=o.useRef(null),_=W!==void 0,[G,K]=o.useState(z),s=_?W:G,[J,F]=o.useState(!1),[r,Q]=o.useState(null),D=o.useCallback(n=>{_||K(n),v==null||v(n)},[_,v]),w=o.useCallback(()=>D(!1),[D]);te.useLockBodyScroll(s);const g=o.useCallback(()=>{const n=u.current,t=d.current;if(!n||!t)return;const e=n.getBoundingClientRect(),l=t.offsetWidth,a=t.offsetHeight,i=window.innerWidth,E=window.innerHeight,c=ie,m=E-e.bottom-p-c,k=e.top-p-c;let f=L.startsWith("bottom")?"bottom":"top";f==="bottom"&&a>m&&k>m?f="top":f==="top"&&a>k&&m>k&&(f="bottom");const I=Math.max(0,f==="bottom"?m:k),P=Math.min(a,I);let R=f==="bottom"?e.bottom+p:e.top-p-P;R=Math.min(Math.max(R,c),Math.max(c,E-c-P));let q=L.endsWith("end")?e.right-l:e.left;q=Math.min(Math.max(q,c),Math.max(c,i-c-l)),Q({top:R,left:q,side:f,maxHeight:I,minWidth:H?e.width:void 0})},[L,p,H]);o.useLayoutEffect(()=>{if(!s){F(!1);return}g()},[s,g]),o.useEffect(()=>{if(!s)return;const n=requestAnimationFrame(()=>F(!0)),t=()=>g();window.addEventListener("resize",t),window.addEventListener("scroll",t,!0);let e;return typeof ResizeObserver<"u"&&(e=new ResizeObserver(t),d.current&&e.observe(d.current),u.current&&e.observe(u.current)),()=>{cancelAnimationFrame(n),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0),e==null||e.disconnect()}},[s,g]),o.useEffect(()=>{if(!s)return;const n=e=>{var a,i;const l=e.target;(a=u.current)!=null&&a.contains(l)||(i=d.current)!=null&&i.contains(l)||w()},t=e=>{var l,a;if(e.key==="Escape")e.preventDefault(),w(),(l=u.current)==null||l.focus();else if(e.key==="Tab")w();else if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const i=C(d.current);if(!i.length)return;const E=i.indexOf(document.activeElement),c=e.key==="ArrowDown"?1:-1,m=(E+c+i.length)%i.length;(a=i[m])==null||a.focus()}};return document.addEventListener("pointerdown",n,!0),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",n,!0),document.removeEventListener("keydown",t)}},[s,w]),o.useEffect(()=>{if(!s)return;const n=requestAnimationFrame(()=>{var t;return(t=C(d.current)[0])==null?void 0:t.focus()});return()=>cancelAnimationFrame(n)},[s]);const x=b.props,y=x.ref,X=o.cloneElement(b,{ref:n=>{u.current=n,typeof y=="function"?y(n):y&&(y.current=n)},onClick:n=>{var t;(t=x.onClick)==null||t.call(x,n),T||D(!s)},"aria-haspopup":"menu","aria-expanded":s,"aria-controls":s?S:void 0}),Y=n=>{var e;if(!N)return;const t=n.target.closest(j);t&&t.getAttribute("aria-disabled")!=="true"&&(w(),(e=u.current)==null||e.focus())};return A.jsxs(A.Fragment,{children:[X,s&&Z.createPortal(A.jsx("div",{ref:d,id:S,className:$.clsx(B.panel,O&&B[M],U),"data-open":J?"true":"false","data-side":(r==null?void 0:r.side)??"bottom",style:{position:"fixed",top:(r==null?void 0:r.top)??0,left:(r==null?void 0:r.left)??0,maxHeight:r==null?void 0:r.maxHeight,minWidth:r==null?void 0:r.minWidth,visibility:r?"visible":"hidden",...V},onClick:Y,children:A.jsx(ee.List,{role:"menu",size:M,padding:"xs",children:h})}),document.body)]})}exports.Dropdown=ce;
2
- //# sourceMappingURL=Dropdown-DygP50OB.cjs.map
1
+ "use strict";const A=require("react/jsx-runtime"),o=require("react"),Z=require("react-dom"),$=require("clsx"),ee=require("./List-ChXO0Hz-.cjs"),te=require("./useLockBodyScroll-CIXHZo-Q.cjs"),ne="_panel_ntp6g_4",re="_sm_ntp6g_21",oe="_md_ntp6g_24",se="_lg_ntp6g_27",B={panel:ne,sm:re,md:oe,lg:se},ie=8,j='[role="menuitem"],[role="button"],a[href],button:not([disabled]),[tabindex]:not([tabindex="-1"])';function C(b){return b?Array.from(b.querySelectorAll(j)).filter(h=>h.getAttribute("aria-disabled")!=="true"&&h.offsetParent!==null):[]}function ce({trigger:b,children:h,placement:L="bottom-start",size:M="md",minWidth:O=!0,open:W,defaultOpen:z=!1,onOpenChange:v,closeOnSelect:N=!0,matchTriggerWidth:H=!1,disabled:T=!1,offset:p=6,className:U,style:V}){const S=o.useId(),u=o.useRef(null),d=o.useRef(null),_=W!==void 0,[G,K]=o.useState(z),s=_?W:G,[J,F]=o.useState(!1),[r,Q]=o.useState(null),D=o.useCallback(n=>{_||K(n),v==null||v(n)},[_,v]),w=o.useCallback(()=>D(!1),[D]);te.useLockBodyScroll(s);const g=o.useCallback(()=>{const n=u.current,t=d.current;if(!n||!t)return;const e=n.getBoundingClientRect(),l=t.offsetWidth,a=t.offsetHeight,i=window.innerWidth,E=window.innerHeight,c=ie,m=E-e.bottom-p-c,k=e.top-p-c;let f=L.startsWith("bottom")?"bottom":"top";f==="bottom"&&a>m&&k>m?f="top":f==="top"&&a>k&&m>k&&(f="bottom");const I=Math.max(0,f==="bottom"?m:k),P=Math.min(a,I);let R=f==="bottom"?e.bottom+p:e.top-p-P;R=Math.min(Math.max(R,c),Math.max(c,E-c-P));let q=L.endsWith("end")?e.right-l:e.left;q=Math.min(Math.max(q,c),Math.max(c,i-c-l)),Q({top:R,left:q,side:f,maxHeight:I,minWidth:H?e.width:void 0})},[L,p,H]);o.useLayoutEffect(()=>{if(!s){F(!1);return}g()},[s,g]),o.useEffect(()=>{if(!s)return;const n=requestAnimationFrame(()=>F(!0)),t=()=>g();window.addEventListener("resize",t),window.addEventListener("scroll",t,!0);let e;return typeof ResizeObserver<"u"&&(e=new ResizeObserver(t),d.current&&e.observe(d.current),u.current&&e.observe(u.current)),()=>{cancelAnimationFrame(n),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0),e==null||e.disconnect()}},[s,g]),o.useEffect(()=>{if(!s)return;const n=e=>{var a,i;const l=e.target;(a=u.current)!=null&&a.contains(l)||(i=d.current)!=null&&i.contains(l)||w()},t=e=>{var l,a;if(e.key==="Escape")e.preventDefault(),w(),(l=u.current)==null||l.focus();else if(e.key==="Tab")w();else if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const i=C(d.current);if(!i.length)return;const E=i.indexOf(document.activeElement),c=e.key==="ArrowDown"?1:-1,m=(E+c+i.length)%i.length;(a=i[m])==null||a.focus()}};return document.addEventListener("pointerdown",n,!0),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",n,!0),document.removeEventListener("keydown",t)}},[s,w]),o.useEffect(()=>{if(!s)return;const n=requestAnimationFrame(()=>{var t;return(t=C(d.current)[0])==null?void 0:t.focus()});return()=>cancelAnimationFrame(n)},[s]);const x=b.props,y=x.ref,X=o.cloneElement(b,{ref:n=>{u.current=n,typeof y=="function"?y(n):y&&(y.current=n)},onClick:n=>{var t;(t=x.onClick)==null||t.call(x,n),T||D(!s)},"aria-haspopup":"menu","aria-expanded":s,"aria-controls":s?S:void 0}),Y=n=>{var e;if(!N)return;const t=n.target.closest(j);t&&t.getAttribute("aria-disabled")!=="true"&&(w(),(e=u.current)==null||e.focus())};return A.jsxs(A.Fragment,{children:[X,s&&Z.createPortal(A.jsx("div",{ref:d,id:S,className:$.clsx(B.panel,O&&B[M],U),"data-open":J?"true":"false","data-side":(r==null?void 0:r.side)??"bottom",style:{position:"fixed",top:(r==null?void 0:r.top)??0,left:(r==null?void 0:r.left)??0,maxHeight:r==null?void 0:r.maxHeight,minWidth:r==null?void 0:r.minWidth,visibility:r?"visible":"hidden",...V},onClick:Y,children:A.jsx(ee.List,{role:"menu",size:M,padding:"xs",children:h})}),document.body)]})}exports.Dropdown=ce;
2
+ //# sourceMappingURL=Dropdown-Ui7h2TGd.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dropdown-DygP50OB.cjs","sources":["../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import {\n cloneElement,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type MouseEvent as ReactMouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport { clsx } from 'clsx'\nimport { List, type ListItemSize } from '../List'\nimport { useLockBodyScroll } from '../../hooks/useLockBodyScroll'\nimport styles from './Dropdown.module.css'\n\nexport type DropdownPlacement = 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end'\n\ninterface Position {\n top: number\n left: number\n side: 'top' | 'bottom'\n maxHeight: number\n minWidth?: number\n}\n\nexport interface DropdownProps {\n /** The element that opens the menu (e.g. a `Button` / `IconButton`). Cloned to wire click + a11y. */\n trigger: ReactElement\n /** Menu content — typically `ListItem`s (composed inside a `role=\"menu\"` `List`). */\n children: ReactNode\n /** Preferred placement. Flips to the opposite side automatically when it would overflow. Default `bottom-start`. */\n placement?: DropdownPlacement\n /** Menu size — sets the panel min-width (`sm` 150 · `md` 190 · `lg` 220) and the items' density. Default `md`. */\n size?: ListItemSize\n /**\n * Apply the size-based min-width (`sm` 150 · `md` 190 · `lg` 220px). Defaults to `true`; set `false`\n * to let the menu size to its content instead (the items' density still tracks `size`).\n */\n minWidth?: boolean\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Close the menu when an item inside is clicked. Defaults to `true`. */\n closeOnSelect?: boolean\n /** Make the menu at least as wide as the trigger (select-like). Defaults to `false`. */\n matchTriggerWidth?: boolean\n /** Prevents opening. */\n disabled?: boolean\n /** Gap between the trigger and the menu, in px. Defaults to `6`. */\n offset?: number\n /** Class applied to the floating panel. */\n className?: string\n /** Style applied to the floating panel. */\n style?: CSSProperties\n}\n\n/** Distance the menu is kept from the viewport edges (px). */\nconst VIEWPORT_PADDING = 8\n/** Focusable menu items, used for arrow-key roving. */\nconst FOCUSABLE =\n '[role=\"menuitem\"],[role=\"button\"],a[href],button:not([disabled]),[tabindex]:not([tabindex=\"-1\"])'\n\nfunction focusableItems(panel: HTMLElement | null): HTMLElement[] {\n if (!panel) return []\n return Array.from(panel.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n (el) => el.getAttribute('aria-disabled') !== 'true' && el.offsetParent !== null,\n )\n}\n\n/**\n * A floating menu anchored to a `trigger`. Opens on trigger click; closes on outside click, `Escape`,\n * or selecting an item. The panel is portaled to `document.body` and positioned with collision\n * handling — it **flips** to the opposite side when it would overflow, clamps within the viewport, and\n * re-positions on scroll/resize (a too-tall menu caps its height and scrolls). Arrow keys move between\n * items; `Escape` returns focus to the trigger. Compose `ListItem`s as `children`.\n */\nexport function Dropdown({\n trigger,\n children,\n placement = 'bottom-start',\n size = 'md',\n minWidth = true,\n open,\n defaultOpen = false,\n onOpenChange,\n closeOnSelect = true,\n matchTriggerWidth = false,\n disabled = false,\n offset = 6,\n className,\n style,\n}: DropdownProps) {\n const menuId = useId()\n const triggerRef = useRef<HTMLElement | null>(null)\n const panelRef = useRef<HTMLDivElement | null>(null)\n\n const isControlled = open !== undefined\n const [internalOpen, setInternalOpen] = useState(defaultOpen)\n const isOpen = isControlled ? open : internalOpen\n const [visible, setVisible] = useState(false)\n const [pos, setPos] = useState<Position | null>(null)\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) setInternalOpen(next)\n onOpenChange?.(next)\n },\n [isControlled, onOpenChange],\n )\n const close = useCallback(() => setOpen(false), [setOpen])\n\n // lock page scroll while the menu is open (no scrollbar shift)\n useLockBodyScroll(isOpen)\n\n // ── positioning: flip when it would overflow, clamp inside the viewport ──\n const update = useCallback(() => {\n const triggerEl = triggerRef.current\n const panel = panelRef.current\n if (!triggerEl || !panel) return\n\n const rect = triggerEl.getBoundingClientRect()\n const panelW = panel.offsetWidth\n const panelH = panel.offsetHeight\n const vw = window.innerWidth\n const vh = window.innerHeight\n const pad = VIEWPORT_PADDING\n\n const spaceBelow = vh - rect.bottom - offset - pad\n const spaceAbove = rect.top - offset - pad\n let side: 'top' | 'bottom' = placement.startsWith('bottom') ? 'bottom' : 'top'\n // flip only when the preferred side can't fit AND the opposite side has more room\n if (side === 'bottom' && panelH > spaceBelow && spaceAbove > spaceBelow) side = 'top'\n else if (side === 'top' && panelH > spaceAbove && spaceBelow > spaceAbove) side = 'bottom'\n\n const available = side === 'bottom' ? spaceBelow : spaceAbove\n const maxHeight = Math.max(0, available)\n const usedH = Math.min(panelH, maxHeight)\n\n let top = side === 'bottom' ? rect.bottom + offset : rect.top - offset - usedH\n top = Math.min(Math.max(top, pad), Math.max(pad, vh - pad - usedH))\n\n let left = placement.endsWith('end') ? rect.right - panelW : rect.left\n left = Math.min(Math.max(left, pad), Math.max(pad, vw - pad - panelW))\n\n setPos({ top, left, side, maxHeight, minWidth: matchTriggerWidth ? rect.width : undefined })\n }, [placement, offset, matchTriggerWidth])\n\n // position synchronously before paint whenever the menu is open\n useLayoutEffect(() => {\n if (!isOpen) {\n setVisible(false)\n return\n }\n update()\n }, [isOpen, update])\n\n // enter transition + reposition listeners while open\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => setVisible(true))\n\n const onReposition = () => update()\n window.addEventListener('resize', onReposition)\n window.addEventListener('scroll', onReposition, true)\n let ro: ResizeObserver | undefined\n if (typeof ResizeObserver !== 'undefined') {\n ro = new ResizeObserver(onReposition)\n if (panelRef.current) ro.observe(panelRef.current)\n if (triggerRef.current) ro.observe(triggerRef.current)\n }\n\n return () => {\n cancelAnimationFrame(raf)\n window.removeEventListener('resize', onReposition)\n window.removeEventListener('scroll', onReposition, true)\n ro?.disconnect()\n }\n }, [isOpen, update])\n\n // outside click + keyboard (Escape, arrow roving)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node\n if (triggerRef.current?.contains(target) || panelRef.current?.contains(target)) return\n close()\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault()\n close()\n triggerRef.current?.focus()\n } else if (event.key === 'Tab') {\n // Tab would move focus by portal DOM order (end of <body>), orphaning the open menu — close it\n // and let focus continue naturally from the trigger (Select/MultiSelect do the same)\n close()\n } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n const items = focusableItems(panelRef.current)\n if (!items.length) return\n const current = items.indexOf(document.activeElement as HTMLElement)\n const delta = event.key === 'ArrowDown' ? 1 : -1\n const next = (current + delta + items.length) % items.length\n items[next]?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen, close])\n\n // focus the first item once the menu is open and positioned\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => focusableItems(panelRef.current)[0]?.focus())\n return () => cancelAnimationFrame(raf)\n }, [isOpen])\n\n const triggerProps = trigger.props as {\n onClick?: (event: ReactMouseEvent) => void\n ref?: Ref<HTMLElement>\n }\n const originalRef = triggerProps.ref\n\n const clonedTrigger = cloneElement(trigger as ReactElement<Record<string, unknown>>, {\n ref: (node: HTMLElement | null) => {\n triggerRef.current = node\n if (typeof originalRef === 'function') originalRef(node)\n else if (originalRef) (originalRef as { current: HTMLElement | null }).current = node\n },\n onClick: (event: ReactMouseEvent) => {\n triggerProps.onClick?.(event)\n if (!disabled) setOpen(!isOpen)\n },\n 'aria-haspopup': 'menu',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? menuId : undefined,\n })\n\n const handlePanelClick = (event: ReactMouseEvent) => {\n if (!closeOnSelect) return\n const item = (event.target as HTMLElement).closest(FOCUSABLE)\n if (item && item.getAttribute('aria-disabled') !== 'true') {\n close()\n triggerRef.current?.focus()\n }\n }\n\n return (\n <>\n {clonedTrigger}\n {isOpen &&\n createPortal(\n <div\n ref={panelRef}\n id={menuId}\n className={clsx(styles.panel, minWidth && styles[size], className)}\n data-open={visible ? 'true' : 'false'}\n data-side={pos?.side ?? 'bottom'}\n style={{\n position: 'fixed',\n top: pos?.top ?? 0,\n left: pos?.left ?? 0,\n maxHeight: pos?.maxHeight,\n minWidth: pos?.minWidth,\n visibility: pos ? 'visible' : 'hidden',\n ...style,\n }}\n onClick={handlePanelClick}\n >\n <List role=\"menu\" size={size} padding=\"xs\">\n {children}\n </List>\n </div>,\n document.body,\n )}\n </>\n )\n}\n"],"names":["VIEWPORT_PADDING","FOCUSABLE","focusableItems","panel","el","Dropdown","trigger","children","placement","size","minWidth","open","defaultOpen","onOpenChange","closeOnSelect","matchTriggerWidth","disabled","offset","className","style","menuId","useId","triggerRef","useRef","panelRef","isControlled","internalOpen","setInternalOpen","useState","isOpen","visible","setVisible","pos","setPos","setOpen","useCallback","next","close","useLockBodyScroll","update","triggerEl","rect","panelW","panelH","vw","vh","pad","spaceBelow","spaceAbove","side","maxHeight","usedH","top","left","useLayoutEffect","useEffect","raf","onReposition","ro","onPointerDown","event","target","_a","_b","onKeyDown","items","current","delta","triggerProps","originalRef","clonedTrigger","cloneElement","node","handlePanelClick","item","jsxs","Fragment","createPortal","jsx","clsx","styles","List"],"mappings":"wSAiEMA,GAAmB,EAEnBC,EACJ,mGAEF,SAASC,EAAeC,EAA0C,CAChE,OAAKA,EACE,MAAM,KAAKA,EAAM,iBAA8BF,CAAS,CAAC,EAAE,OAC/DG,GAAOA,EAAG,aAAa,eAAe,IAAM,QAAUA,EAAG,eAAiB,IAAA,EAF1D,CAAA,CAIrB,CASO,SAASC,GAAS,CACvB,QAAAC,EACA,SAAAC,EACA,UAAAC,EAAY,eACZ,KAAAC,EAAO,KACP,SAAAC,EAAW,GACX,KAAAC,EACA,YAAAC,EAAc,GACd,aAAAC,EACA,cAAAC,EAAgB,GAChB,kBAAAC,EAAoB,GACpB,SAAAC,EAAW,GACX,OAAAC,EAAS,EACT,UAAAC,EACA,MAAAC,CACF,EAAkB,CAChB,MAAMC,EAASC,EAAAA,MAAA,EACTC,EAAaC,EAAAA,OAA2B,IAAI,EAC5CC,EAAWD,EAAAA,OAA8B,IAAI,EAE7CE,EAAed,IAAS,OACxB,CAACe,EAAcC,CAAe,EAAIC,EAAAA,SAAShB,CAAW,EACtDiB,EAASJ,EAAed,EAAOe,EAC/B,CAACI,EAASC,CAAU,EAAIH,EAA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S,MAAA,CACpC,EAEKqD,EAAoBb,GAA2B,OACnD,GAAI,CAAC9C,EAAe,OACpB,MAAM4D,EAAQd,EAAM,OAAuB,QAAQ3D,CAAS,EACxDyE,GAAQA,EAAK,aAAa,eAAe,IAAM,SACjDrC,EAAA,GACAyB,EAAAxC,EAAW,UAAX,MAAAwC,EAAoB,QAExB,EAEA,OACEa,EAAAA,KAAAC,WAAA,CACG,SAAA,CAAAN,EACAzC,GACCgD,EAAAA,aACEC,EAAAA,IAAC,MAAA,CACC,IAAKtD,EACL,GAAIJ,EACJ,UAAW2D,EAAAA,KAAKC,EAAO,MAAOtE,GAAYsE,EAAOvE,CAAI,EAAGS,CAAS,EACjE,YAAWY,EAAU,OAAS,QAC9B,aAAWE,GAAA,YAAAA,EAAK,OAAQ,SACxB,MAAO,CACL,SAAU,QACV,KAAKA,GAAA,YAAAA,EAAK,MAAO,EACjB,MAAMA,GAAA,YAAAA,EAAK,OAAQ,EACnB,UAAWA,GAAA,YAAAA,EAAK,UAChB,SAAUA,GAAA,YAAAA,EAAK,SACf,WAAYA,EAAM,UAAY,SAC9B,GAAGb,CAAA,EAEL,QAASsD,EAET,eAACQ,GAAAA,KAAA,CAAK,KAAK,OAAO,KAAAxE,EAAY,QAAQ,KACnC,SAAAF,CAAA,CACH,CAAA,CAAA,EAEF,SAAS,IAAA,CACX,EACJ,CAEJ"}
1
+ {"version":3,"file":"Dropdown-Ui7h2TGd.cjs","sources":["../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import {\n cloneElement,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type MouseEvent as ReactMouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport { clsx } from 'clsx'\nimport { List, type ListItemSize } from '../List'\nimport { useLockBodyScroll } from '../../hooks/useLockBodyScroll'\nimport styles from './Dropdown.module.css'\n\nexport type DropdownPlacement = 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end'\n\ninterface Position {\n top: number\n left: number\n side: 'top' | 'bottom'\n maxHeight: number\n minWidth?: number\n}\n\nexport interface DropdownProps {\n /** The element that opens the menu (e.g. a `Button` / `IconButton`). Cloned to wire click + a11y. */\n trigger: ReactElement\n /** Menu content — typically `ListItem`s (composed inside a `role=\"menu\"` `List`). */\n children: ReactNode\n /** Preferred placement. Flips to the opposite side automatically when it would overflow. Default `bottom-start`. */\n placement?: DropdownPlacement\n /** Menu size — sets the panel min-width (`sm` 150 · `md` 190 · `lg` 220) and the items' density. Default `md`. */\n size?: ListItemSize\n /**\n * Apply the size-based min-width (`sm` 150 · `md` 190 · `lg` 220px). Defaults to `true`; set `false`\n * to let the menu size to its content instead (the items' density still tracks `size`).\n */\n minWidth?: boolean\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Close the menu when an item inside is clicked. Defaults to `true`. */\n closeOnSelect?: boolean\n /** Make the menu at least as wide as the trigger (select-like). Defaults to `false`. */\n matchTriggerWidth?: boolean\n /** Prevents opening. */\n disabled?: boolean\n /** Gap between the trigger and the menu, in px. Defaults to `6`. */\n offset?: number\n /** Class applied to the floating panel. */\n className?: string\n /** Style applied to the floating panel. */\n style?: CSSProperties\n}\n\n/** Distance the menu is kept from the viewport edges (px). */\nconst VIEWPORT_PADDING = 8\n/** Focusable menu items, used for arrow-key roving. */\nconst FOCUSABLE =\n '[role=\"menuitem\"],[role=\"button\"],a[href],button:not([disabled]),[tabindex]:not([tabindex=\"-1\"])'\n\nfunction focusableItems(panel: HTMLElement | null): HTMLElement[] {\n if (!panel) return []\n return Array.from(panel.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n (el) => el.getAttribute('aria-disabled') !== 'true' && el.offsetParent !== null,\n )\n}\n\n/**\n * A floating menu anchored to a `trigger`. Opens on trigger click; closes on outside click, `Escape`,\n * or selecting an item. The panel is portaled to `document.body` and positioned with collision\n * handling — it **flips** to the opposite side when it would overflow, clamps within the viewport, and\n * re-positions on scroll/resize (a too-tall menu caps its height and scrolls). Arrow keys move between\n * items; `Escape` returns focus to the trigger. Compose `ListItem`s as `children`.\n */\nexport function Dropdown({\n trigger,\n children,\n placement = 'bottom-start',\n size = 'md',\n minWidth = true,\n open,\n defaultOpen = false,\n onOpenChange,\n closeOnSelect = true,\n matchTriggerWidth = false,\n disabled = false,\n offset = 6,\n className,\n style,\n}: DropdownProps) {\n const menuId = useId()\n const triggerRef = useRef<HTMLElement | null>(null)\n const panelRef = useRef<HTMLDivElement | null>(null)\n\n const isControlled = open !== undefined\n const [internalOpen, setInternalOpen] = useState(defaultOpen)\n const isOpen = isControlled ? open : internalOpen\n const [visible, setVisible] = useState(false)\n const [pos, setPos] = useState<Position | null>(null)\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) setInternalOpen(next)\n onOpenChange?.(next)\n },\n [isControlled, onOpenChange],\n )\n const close = useCallback(() => setOpen(false), [setOpen])\n\n // lock page scroll while the menu is open (no scrollbar shift)\n useLockBodyScroll(isOpen)\n\n // ── positioning: flip when it would overflow, clamp inside the viewport ──\n const update = useCallback(() => {\n const triggerEl = triggerRef.current\n const panel = panelRef.current\n if (!triggerEl || !panel) return\n\n const rect = triggerEl.getBoundingClientRect()\n const panelW = panel.offsetWidth\n const panelH = panel.offsetHeight\n const vw = window.innerWidth\n const vh = window.innerHeight\n const pad = VIEWPORT_PADDING\n\n const spaceBelow = vh - rect.bottom - offset - pad\n const spaceAbove = rect.top - offset - pad\n let side: 'top' | 'bottom' = placement.startsWith('bottom') ? 'bottom' : 'top'\n // flip only when the preferred side can't fit AND the opposite side has more room\n if (side === 'bottom' && panelH > spaceBelow && spaceAbove > spaceBelow) side = 'top'\n else if (side === 'top' && panelH > spaceAbove && spaceBelow > spaceAbove) side = 'bottom'\n\n const available = side === 'bottom' ? spaceBelow : spaceAbove\n const maxHeight = Math.max(0, available)\n const usedH = Math.min(panelH, maxHeight)\n\n let top = side === 'bottom' ? rect.bottom + offset : rect.top - offset - usedH\n top = Math.min(Math.max(top, pad), Math.max(pad, vh - pad - usedH))\n\n let left = placement.endsWith('end') ? rect.right - panelW : rect.left\n left = Math.min(Math.max(left, pad), Math.max(pad, vw - pad - panelW))\n\n setPos({ top, left, side, maxHeight, minWidth: matchTriggerWidth ? rect.width : undefined })\n }, [placement, offset, matchTriggerWidth])\n\n // position synchronously before paint whenever the menu is open\n useLayoutEffect(() => {\n if (!isOpen) {\n setVisible(false)\n return\n }\n update()\n }, [isOpen, update])\n\n // enter transition + reposition listeners while open\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => setVisible(true))\n\n const onReposition = () => update()\n window.addEventListener('resize', onReposition)\n window.addEventListener('scroll', onReposition, true)\n let ro: ResizeObserver | undefined\n if (typeof ResizeObserver !== 'undefined') {\n ro = new ResizeObserver(onReposition)\n if (panelRef.current) ro.observe(panelRef.current)\n if (triggerRef.current) ro.observe(triggerRef.current)\n }\n\n return () => {\n cancelAnimationFrame(raf)\n window.removeEventListener('resize', onReposition)\n window.removeEventListener('scroll', onReposition, true)\n ro?.disconnect()\n }\n }, [isOpen, update])\n\n // outside click + keyboard (Escape, arrow roving)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node\n if (triggerRef.current?.contains(target) || panelRef.current?.contains(target)) return\n close()\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault()\n close()\n triggerRef.current?.focus()\n } else if (event.key === 'Tab') {\n // Tab would move focus by portal DOM order (end of <body>), orphaning the open menu — close it\n // and let focus continue naturally from the trigger (Select/MultiSelect do the same)\n close()\n } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n const items = focusableItems(panelRef.current)\n if (!items.length) return\n const current = items.indexOf(document.activeElement as HTMLElement)\n const delta = event.key === 'ArrowDown' ? 1 : -1\n const next = (current + delta + items.length) % items.length\n items[next]?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen, close])\n\n // focus the first item once the menu is open and positioned\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => focusableItems(panelRef.current)[0]?.focus())\n return () => cancelAnimationFrame(raf)\n }, [isOpen])\n\n const triggerProps = trigger.props as {\n onClick?: (event: ReactMouseEvent) => void\n ref?: Ref<HTMLElement>\n }\n const originalRef = triggerProps.ref\n\n const clonedTrigger = cloneElement(trigger as ReactElement<Record<string, unknown>>, {\n ref: (node: HTMLElement | null) => {\n triggerRef.current = node\n if (typeof originalRef === 'function') originalRef(node)\n else if (originalRef) (originalRef as { current: HTMLElement | null }).current = node\n },\n onClick: (event: ReactMouseEvent) => {\n triggerProps.onClick?.(event)\n if (!disabled) setOpen(!isOpen)\n },\n 'aria-haspopup': 'menu',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? menuId : undefined,\n })\n\n const handlePanelClick = (event: ReactMouseEvent) => {\n if (!closeOnSelect) return\n const item = (event.target as HTMLElement).closest(FOCUSABLE)\n if (item && item.getAttribute('aria-disabled') !== 'true') {\n close()\n triggerRef.current?.focus()\n }\n }\n\n return (\n <>\n {clonedTrigger}\n {isOpen &&\n createPortal(\n <div\n ref={panelRef}\n id={menuId}\n className={clsx(styles.panel, minWidth && styles[size], className)}\n data-open={visible ? 'true' : 'false'}\n data-side={pos?.side ?? 'bottom'}\n style={{\n position: 'fixed',\n top: pos?.top ?? 0,\n left: pos?.left ?? 0,\n maxHeight: pos?.maxHeight,\n minWidth: pos?.minWidth,\n visibility: pos ? 'visible' : 'hidden',\n ...style,\n }}\n onClick={handlePanelClick}\n >\n <List role=\"menu\" size={size} padding=\"xs\">\n {children}\n </List>\n </div>,\n document.body,\n )}\n </>\n )\n}\n"],"names":["VIEWPORT_PADDING","FOCUSABLE","focusableItems","panel","el","Dropdown","trigger","children","placement","size","minWidth","open","defaultOpen","onOpenChange","closeOnSelect","matchTriggerWidth","disabled","offset","className","style","menuId","useId","triggerRef","useRef","panelRef","isControlled","internalOpen","setInternalOpen","useState","isOpen","visible","setVisible","pos","setPos","setOpen","useCallback","next","close","useLockBodyScroll","update","triggerEl","rect","panelW","panelH","vw","vh","pad","spaceBelow","spaceAbove","side","maxHeight","usedH","top","left","useLayoutEffect","useEffect","raf","onReposition","ro","onPointerDown","event","target","_a","_b","onKeyDown","items","current","delta","triggerProps","originalRef","clonedTrigger","cloneElement","node","handlePanelClick","item","jsxs","Fragment","createPortal","jsx","clsx","styles","List"],"mappings":"wSAiEMA,GAAmB,EAEnBC,EACJ,mGAEF,SAASC,EAAeC,EAA0C,CAChE,OAAKA,EACE,MAAM,KAAKA,EAAM,iBAA8BF,CAAS,CAAC,EAAE,OAC/DG,GAAOA,EAAG,aAAa,eAAe,IAAM,QAAUA,EAAG,eAAiB,IAAA,EAF1D,CAAA,CAIrB,CASO,SAASC,GAAS,CACvB,QAAAC,EACA,SAAAC,EACA,UAAAC,EAAY,eACZ,KAAAC,EAAO,KACP,SAAAC,EAAW,GACX,KAAAC,EACA,YAAAC,EAAc,GACd,aAAAC,EACA,cAAAC,EAAgB,GAChB,kBAAAC,EAAoB,GACpB,SAAAC,EAAW,GACX,OAAAC,EAAS,EACT,UAAAC,EACA,MAAAC,CACF,EAAkB,CAChB,MAAMC,EAASC,EAAAA,MAAA,EACTC,EAAaC,EAAAA,OAA2B,IAAI,EAC5CC,EAAWD,EAAAA,OAA8B,IAAI,EAE7CE,EAAed,IAAS,OACxB,CAACe,EAAcC,CAAe,EAAIC,EAAAA,SAAShB,CAAW,EACtDiB,EAASJ,EAAed,EAAOe,EAC/B,CAACI,EAASC,CAAU,EAAIH,EAAAA,SAAS,EAAK,EACtC,CAACI,EAAKC,CAAM,EAAIL,EAAA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AC9C,EAAe,OACpB,MAAM4D,EAAQd,EAAM,OAAuB,QAAQ3D,CAAS,EACxDyE,GAAQA,EAAK,aAAa,eAAe,IAAM,SACjDrC,EAAA,GACAyB,EAAAxC,EAAW,UAAX,MAAAwC,EAAoB,QAExB,EAEA,OACEa,EAAAA,KAAAC,WAAA,CACG,SAAA,CAAAN,EACAzC,GACCgD,EAAAA,aACEC,EAAAA,IAAC,MAAA,CACC,IAAKtD,EACL,GAAIJ,EACJ,UAAW2D,EAAAA,KAAKC,EAAO,MAAOtE,GAAYsE,EAAOvE,CAAI,EAAGS,CAAS,EACjE,YAAWY,EAAU,OAAS,QAC9B,aAAWE,GAAA,YAAAA,EAAK,OAAQ,SACxB,MAAO,CACL,SAAU,QACV,KAAKA,GAAA,YAAAA,EAAK,MAAO,EACjB,MAAMA,GAAA,YAAAA,EAAK,OAAQ,EACnB,UAAWA,GAAA,YAAAA,EAAK,UAChB,SAAUA,GAAA,YAAAA,EAAK,SACf,WAAYA,EAAM,UAAY,SAC9B,GAAGb,CAAA,EAEL,QAASsD,EAET,eAACQ,GAAAA,KAAA,CAAK,KAAK,OAAO,KAAAxE,EAAY,QAAQ,KACnC,SAAAF,CAAA,CACH,CAAA,CAAA,EAEF,SAAS,IAAA,CACX,EACJ,CAEJ"}
@@ -1,2 +1,2 @@
1
- "use strict";const t=require("react/jsx-runtime"),x=require("react"),y=require("clsx"),l=require("./Icon-CXTl_QAP.cjs"),z=require("./names-C2Yj1p3u.cjs"),N=require("./ConfigProvider-ByOFXVyP.cjs"),j="_emptyState_tu8zp_3",h="_sm_tu8zp_17",v="_md_tu8zp_23",f="_lg_tu8zp_29",q="_icon_tu8zp_37",E="_title_tu8zp_53",I="_description_tu8zp_59",g="_action_tu8zp_68",C="_pattern_tu8zp_75",e={emptyState:j,sm:h,md:v,lg:f,icon:q,title:E,description:I,action:g,pattern:C},O=new Set(z.ICON_NAMES),T=x.forwardRef(function({icon:n,title:o,description:s,action:c,size:a="md",pattern:_=!0,className:u,children:p,...d},m){const S=N.useT(),r=o??S("emptyState.title"),i=n===!1?null:n==null?t.jsx(l.Icon,{name:"FolderOpen"}):typeof n=="string"&&O.has(n)?t.jsx(l.Icon,{name:n}):n;return t.jsxs("div",{ref:m,className:y.clsx(e.emptyState,e[a],_&&e.pattern,u),...d,children:[i!=null&&t.jsx("div",{className:e.icon,"aria-hidden":!0,children:i}),r!=null&&t.jsx("div",{className:e.title,children:r}),s!=null&&t.jsx("div",{className:e.description,children:s}),c!=null&&t.jsx("div",{className:e.action,children:c}),p]})});exports.EmptyState=T;
2
- //# sourceMappingURL=EmptyState-CCCpZ-ZA.cjs.map
1
+ "use strict";const t=require("react/jsx-runtime"),x=require("react"),y=require("clsx"),l=require("./Icon-CXTl_QAP.cjs"),z=require("./names-C2Yj1p3u.cjs"),N=require("./ConfigProvider-BHNx-NHV.cjs"),j="_emptyState_tu8zp_3",h="_sm_tu8zp_17",v="_md_tu8zp_23",f="_lg_tu8zp_29",q="_icon_tu8zp_37",E="_title_tu8zp_53",I="_description_tu8zp_59",g="_action_tu8zp_68",C="_pattern_tu8zp_75",e={emptyState:j,sm:h,md:v,lg:f,icon:q,title:E,description:I,action:g,pattern:C},O=new Set(z.ICON_NAMES),T=x.forwardRef(function({icon:n,title:o,description:s,action:c,size:a="md",pattern:_=!0,className:u,children:p,...d},m){const S=N.useT(),r=o??S("emptyState.title"),i=n===!1?null:n==null?t.jsx(l.Icon,{name:"FolderOpen"}):typeof n=="string"&&O.has(n)?t.jsx(l.Icon,{name:n}):n;return t.jsxs("div",{ref:m,className:y.clsx(e.emptyState,e[a],_&&e.pattern,u),...d,children:[i!=null&&t.jsx("div",{className:e.icon,"aria-hidden":!0,children:i}),r!=null&&t.jsx("div",{className:e.title,children:r}),s!=null&&t.jsx("div",{className:e.description,children:s}),c!=null&&t.jsx("div",{className:e.action,children:c}),p]})});exports.EmptyState=T;
2
+ //# sourceMappingURL=EmptyState-B77utgEn.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyState-CCCpZ-ZA.cjs","sources":["../src/components/EmptyState/EmptyState.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { Icon } from '../Icon'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport styles from './EmptyState.module.css'\n\nexport type EmptyStateSize = 'sm' | 'md' | 'lg'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Leading glyph shown in a soft circle — an `IconName`, any node, or `false` to hide it. Defaults to `FolderOpen`. */\n icon?: IconName | ReactNode | false\n /** Heading line. Defaults to `\"No Results Found\"`. */\n title?: ReactNode\n /** Muted description under the title (e.g. a hint on what to do next). */\n description?: ReactNode\n /** Action slot under the text — e.g. an \"Add Item\" or \"Clear Filters\" button. */\n action?: ReactNode\n /** Size — scales the icon, text, and vertical padding. Defaults to `md`. */\n size?: EmptyStateSize\n /**\n * Polished \"hero\" look: a faded grid backdrop (fades out toward the edges) + an elevated icon\n * (gradient + drop shadow). Defaults to `true`; pass `pattern={false}` for the flat, compact placeholder.\n */\n pattern?: boolean\n /** Extra content rendered below the action. */\n children?: ReactNode\n}\n\n/**\n * The empty-state placeholder — drop it in wherever a page, table, list, or gallery has nothing to\n * show (no records yet, no search matches). A centered, muted glyph in a soft circle + a `title` +\n * an optional `description` and `action` (e.g. a \"Add Item\" / \"Clear Filters\" button). Neutral by\n * design; pass a custom `icon` node for a tinted glyph. Token-only styling.\n */\nexport const EmptyState = forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n { icon, title, description, action, size = 'md', pattern = true, className, children, ...props },\n ref,\n) {\n const t = useT()\n const resolvedTitle = title ?? t('emptyState.title')\n const renderedIcon =\n icon === false ? null : icon == null ? (\n <Icon name=\"FolderOpen\" />\n ) : typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} />\n ) : (\n icon\n )\n\n return (\n <div\n ref={ref}\n className={clsx(styles.emptyState, styles[size], pattern && styles.pattern, className)}\n {...props}\n >\n {renderedIcon != null && (\n <div className={styles.icon} aria-hidden>\n {renderedIcon}\n </div>\n )}\n {resolvedTitle != null && <div className={styles.title}>{resolvedTitle}</div>}\n {description != null && <div className={styles.description}>{description}</div>}\n {action != null && <div className={styles.action}>{action}</div>}\n {children}\n </div>\n )\n})\n"],"names":["ICON_NAME_SET","ICON_NAMES","EmptyState","forwardRef","icon","title","description","action","size","pattern","className","children","props","ref","t","useT","resolvedTitle","renderedIcon","jsx","Icon","jsxs","clsx","styles"],"mappings":"4cASMA,EAAgB,IAAI,IAAYC,YAAU,EA4BnCC,EAAaC,EAAAA,WAA4C,SACpE,CAAE,KAAAC,EAAM,MAAAC,EAAO,YAAAC,EAAa,OAAAC,EAAQ,KAAAC,EAAO,KAAM,QAAAC,EAAU,GAAM,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAA,EACzFC,EACA,CACA,MAAMC,EAAIC,EAAAA,KAAA,EACJC,EAAgBX,GAASS,EAAE,kBAAkB,EAC7CG,EACJb,IAAS,GAAQ,KAAOA,GAAQ,KAC9Bc,MAACC,EAAAA,KAAA,CAAK,KAAK,YAAA,CAAa,EACtB,OAAOf,GAAS,UAAYJ,EAAc,IAAII,CAAI,EACpDc,MAACC,EAAAA,KAAA,CAAK,KAAMf,CAAA,CAAkB,EAE9BA,EAGJ,OACEgB,EAAAA,KAAC,MAAA,CACC,IAAAP,EACA,UAAWQ,EAAAA,KAAKC,EAAO,WAAYA,EAAOd,CAAI,EAAGC,GAAWa,EAAO,QAASZ,CAAS,EACpF,GAAGE,EAEH,SAAA,CAAAK,GAAgB,YACd,MAAA,CAAI,UAAWK,EAAO,KAAM,cAAW,GACrC,SAAAL,CAAA,CACH,EAEDD,GAAiB,MAAQE,EAAAA,IAAC,OAAI,UAAWI,EAAO,MAAQ,SAAAN,EAAc,EACtEV,GAAe,MAAQY,EAAAA,IAAC,OAAI,UAAWI,EAAO,YAAc,SAAAhB,EAAY,EACxEC,GAAU,MAAQW,EAAAA,IAAC,OAAI,UAAWI,EAAO,OAAS,SAAAf,EAAO,EACzDI,CAAA,CAAA,CAAA,CAGP,CAAC"}
1
+ {"version":3,"file":"EmptyState-B77utgEn.cjs","sources":["../src/components/EmptyState/EmptyState.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { Icon } from '../Icon'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport styles from './EmptyState.module.css'\n\nexport type EmptyStateSize = 'sm' | 'md' | 'lg'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Leading glyph shown in a soft circle — an `IconName`, any node, or `false` to hide it. Defaults to `FolderOpen`. */\n icon?: IconName | ReactNode | false\n /** Heading line. Defaults to `\"No Results Found\"`. */\n title?: ReactNode\n /** Muted description under the title (e.g. a hint on what to do next). */\n description?: ReactNode\n /** Action slot under the text — e.g. an \"Add Item\" or \"Clear Filters\" button. */\n action?: ReactNode\n /** Size — scales the icon, text, and vertical padding. Defaults to `md`. */\n size?: EmptyStateSize\n /**\n * Polished \"hero\" look: a faded grid backdrop (fades out toward the edges) + an elevated icon\n * (gradient + drop shadow). Defaults to `true`; pass `pattern={false}` for the flat, compact placeholder.\n */\n pattern?: boolean\n /** Extra content rendered below the action. */\n children?: ReactNode\n}\n\n/**\n * The empty-state placeholder — drop it in wherever a page, table, list, or gallery has nothing to\n * show (no records yet, no search matches). A centered, muted glyph in a soft circle + a `title` +\n * an optional `description` and `action` (e.g. a \"Add Item\" / \"Clear Filters\" button). Neutral by\n * design; pass a custom `icon` node for a tinted glyph. Token-only styling.\n */\nexport const EmptyState = forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n { icon, title, description, action, size = 'md', pattern = true, className, children, ...props },\n ref,\n) {\n const t = useT()\n const resolvedTitle = title ?? t('emptyState.title')\n const renderedIcon =\n icon === false ? null : icon == null ? (\n <Icon name=\"FolderOpen\" />\n ) : typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} />\n ) : (\n icon\n )\n\n return (\n <div\n ref={ref}\n className={clsx(styles.emptyState, styles[size], pattern && styles.pattern, className)}\n {...props}\n >\n {renderedIcon != null && (\n <div className={styles.icon} aria-hidden>\n {renderedIcon}\n </div>\n )}\n {resolvedTitle != null && <div className={styles.title}>{resolvedTitle}</div>}\n {description != null && <div className={styles.description}>{description}</div>}\n {action != null && <div className={styles.action}>{action}</div>}\n {children}\n </div>\n )\n})\n"],"names":["ICON_NAME_SET","ICON_NAMES","EmptyState","forwardRef","icon","title","description","action","size","pattern","className","children","props","ref","t","useT","resolvedTitle","renderedIcon","jsx","Icon","jsxs","clsx","styles"],"mappings":"4cASMA,EAAgB,IAAI,IAAYC,YAAU,EA4BnCC,EAAaC,EAAAA,WAA4C,SACpE,CAAE,KAAAC,EAAM,MAAAC,EAAO,YAAAC,EAAa,OAAAC,EAAQ,KAAAC,EAAO,KAAM,QAAAC,EAAU,GAAM,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAA,EACzFC,EACA,CACA,MAAMC,EAAIC,EAAAA,KAAA,EACJC,EAAgBX,GAASS,EAAE,kBAAkB,EAC7CG,EACJb,IAAS,GAAQ,KAAOA,GAAQ,KAC9Bc,MAACC,EAAAA,KAAA,CAAK,KAAK,YAAA,CAAa,EACtB,OAAOf,GAAS,UAAYJ,EAAc,IAAII,CAAI,EACpDc,MAACC,EAAAA,KAAA,CAAK,KAAMf,CAAA,CAAkB,EAE9BA,EAGJ,OACEgB,EAAAA,KAAC,MAAA,CACC,IAAAP,EACA,UAAWQ,EAAAA,KAAKC,EAAO,WAAYA,EAAOd,CAAI,EAAGC,GAAWa,EAAO,QAASZ,CAAS,EACpF,GAAGE,EAEH,SAAA,CAAAK,GAAgB,YACd,MAAA,CAAI,UAAWK,EAAO,KAAM,cAAW,GACrC,SAAAL,CAAA,CACH,EAEDD,GAAiB,MAAQE,EAAAA,IAAC,OAAI,UAAWI,EAAO,MAAQ,SAAAN,EAAc,EACtEV,GAAe,MAAQY,EAAAA,IAAC,OAAI,UAAWI,EAAO,YAAc,SAAAhB,EAAY,EACxEC,GAAU,MAAQW,EAAAA,IAAC,OAAI,UAAWI,EAAO,OAAS,SAAAf,EAAO,EACzDI,CAAA,CAAA,CAAA,CAGP,CAAC"}
@@ -3,7 +3,7 @@ import { forwardRef as y } from "react";
3
3
  import { clsx as z } from "clsx";
4
4
  import { I as l } from "./Icon-CophpkHo.js";
5
5
  import { a as N } from "./names-D8ABK2Wk.js";
6
- import { a as h } from "./ConfigProvider-2c94kUOk.js";
6
+ import { a as h } from "./ConfigProvider-BYruQYHC.js";
7
7
  const v = "_emptyState_tu8zp_3", E = "_sm_tu8zp_17", I = "_md_tu8zp_23", g = "_lg_tu8zp_29", x = "_icon_tu8zp_37", O = "_title_tu8zp_53", T = "_description_tu8zp_59", j = "_action_tu8zp_68", w = "_pattern_tu8zp_75", t = {
8
8
  emptyState: v,
9
9
  sm: E,
@@ -35,4 +35,4 @@ const v = "_emptyState_tu8zp_3", E = "_sm_tu8zp_17", I = "_md_tu8zp_23", g = "_l
35
35
  export {
36
36
  B as E
37
37
  };
38
- //# sourceMappingURL=EmptyState-CetM49vk.js.map
38
+ //# sourceMappingURL=EmptyState-CVyFXprK.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyState-CetM49vk.js","sources":["../src/components/EmptyState/EmptyState.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { Icon } from '../Icon'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport styles from './EmptyState.module.css'\n\nexport type EmptyStateSize = 'sm' | 'md' | 'lg'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Leading glyph shown in a soft circle — an `IconName`, any node, or `false` to hide it. Defaults to `FolderOpen`. */\n icon?: IconName | ReactNode | false\n /** Heading line. Defaults to `\"No Results Found\"`. */\n title?: ReactNode\n /** Muted description under the title (e.g. a hint on what to do next). */\n description?: ReactNode\n /** Action slot under the text — e.g. an \"Add Item\" or \"Clear Filters\" button. */\n action?: ReactNode\n /** Size — scales the icon, text, and vertical padding. Defaults to `md`. */\n size?: EmptyStateSize\n /**\n * Polished \"hero\" look: a faded grid backdrop (fades out toward the edges) + an elevated icon\n * (gradient + drop shadow). Defaults to `true`; pass `pattern={false}` for the flat, compact placeholder.\n */\n pattern?: boolean\n /** Extra content rendered below the action. */\n children?: ReactNode\n}\n\n/**\n * The empty-state placeholder — drop it in wherever a page, table, list, or gallery has nothing to\n * show (no records yet, no search matches). A centered, muted glyph in a soft circle + a `title` +\n * an optional `description` and `action` (e.g. a \"Add Item\" / \"Clear Filters\" button). Neutral by\n * design; pass a custom `icon` node for a tinted glyph. Token-only styling.\n */\nexport const EmptyState = forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n { icon, title, description, action, size = 'md', pattern = true, className, children, ...props },\n ref,\n) {\n const t = useT()\n const resolvedTitle = title ?? t('emptyState.title')\n const renderedIcon =\n icon === false ? null : icon == null ? (\n <Icon name=\"FolderOpen\" />\n ) : typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} />\n ) : (\n icon\n )\n\n return (\n <div\n ref={ref}\n className={clsx(styles.emptyState, styles[size], pattern && styles.pattern, className)}\n {...props}\n >\n {renderedIcon != null && (\n <div className={styles.icon} aria-hidden>\n {renderedIcon}\n </div>\n )}\n {resolvedTitle != null && <div className={styles.title}>{resolvedTitle}</div>}\n {description != null && <div className={styles.description}>{description}</div>}\n {action != null && <div className={styles.action}>{action}</div>}\n {children}\n </div>\n )\n})\n"],"names":["ICON_NAME_SET","ICON_NAMES","EmptyState","forwardRef","icon","title","description","action","size","pattern","className","children","props","ref","t","useT","resolvedTitle","renderedIcon","jsx","Icon","jsxs","clsx","styles"],"mappings":";;;;;;;;;;;;;;;;GASMA,IAAgB,IAAI,IAAYC,CAAU,GA4BnCC,IAAaC,EAA4C,SACpE,EAAE,MAAAC,GAAM,OAAAC,GAAO,aAAAC,GAAa,QAAAC,GAAQ,MAAAC,IAAO,MAAM,SAAAC,IAAU,IAAM,WAAAC,GAAW,UAAAC,GAAU,GAAGC,EAAA,GACzFC,GACA;AACA,QAAMC,IAAIC,EAAA,GACJC,IAAgBX,KAASS,EAAE,kBAAkB,GAC7CG,IACJb,MAAS,KAAQ,OAAOA,KAAQ,OAC9B,gBAAAc,EAACC,GAAA,EAAK,MAAK,aAAA,CAAa,IACtB,OAAOf,KAAS,YAAYJ,EAAc,IAAII,CAAI,IACpD,gBAAAc,EAACC,GAAA,EAAK,MAAMf,EAAA,CAAkB,IAE9BA;AAGJ,SACE,gBAAAgB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAP;AAAA,MACA,WAAWQ,EAAKC,EAAO,YAAYA,EAAOd,CAAI,GAAGC,KAAWa,EAAO,SAASZ,CAAS;AAAA,MACpF,GAAGE;AAAA,MAEH,UAAA;AAAA,QAAAK,KAAgB,0BACd,OAAA,EAAI,WAAWK,EAAO,MAAM,eAAW,IACrC,UAAAL,EAAA,CACH;AAAA,QAEDD,KAAiB,QAAQ,gBAAAE,EAAC,SAAI,WAAWI,EAAO,OAAQ,UAAAN,GAAc;AAAA,QACtEV,KAAe,QAAQ,gBAAAY,EAAC,SAAI,WAAWI,EAAO,aAAc,UAAAhB,GAAY;AAAA,QACxEC,KAAU,QAAQ,gBAAAW,EAAC,SAAI,WAAWI,EAAO,QAAS,UAAAf,GAAO;AAAA,QACzDI;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
1
+ {"version":3,"file":"EmptyState-CVyFXprK.js","sources":["../src/components/EmptyState/EmptyState.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { Icon } from '../Icon'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport styles from './EmptyState.module.css'\n\nexport type EmptyStateSize = 'sm' | 'md' | 'lg'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Leading glyph shown in a soft circle — an `IconName`, any node, or `false` to hide it. Defaults to `FolderOpen`. */\n icon?: IconName | ReactNode | false\n /** Heading line. Defaults to `\"No Results Found\"`. */\n title?: ReactNode\n /** Muted description under the title (e.g. a hint on what to do next). */\n description?: ReactNode\n /** Action slot under the text — e.g. an \"Add Item\" or \"Clear Filters\" button. */\n action?: ReactNode\n /** Size — scales the icon, text, and vertical padding. Defaults to `md`. */\n size?: EmptyStateSize\n /**\n * Polished \"hero\" look: a faded grid backdrop (fades out toward the edges) + an elevated icon\n * (gradient + drop shadow). Defaults to `true`; pass `pattern={false}` for the flat, compact placeholder.\n */\n pattern?: boolean\n /** Extra content rendered below the action. */\n children?: ReactNode\n}\n\n/**\n * The empty-state placeholder — drop it in wherever a page, table, list, or gallery has nothing to\n * show (no records yet, no search matches). A centered, muted glyph in a soft circle + a `title` +\n * an optional `description` and `action` (e.g. a \"Add Item\" / \"Clear Filters\" button). Neutral by\n * design; pass a custom `icon` node for a tinted glyph. Token-only styling.\n */\nexport const EmptyState = forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n { icon, title, description, action, size = 'md', pattern = true, className, children, ...props },\n ref,\n) {\n const t = useT()\n const resolvedTitle = title ?? t('emptyState.title')\n const renderedIcon =\n icon === false ? null : icon == null ? (\n <Icon name=\"FolderOpen\" />\n ) : typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} />\n ) : (\n icon\n )\n\n return (\n <div\n ref={ref}\n className={clsx(styles.emptyState, styles[size], pattern && styles.pattern, className)}\n {...props}\n >\n {renderedIcon != null && (\n <div className={styles.icon} aria-hidden>\n {renderedIcon}\n </div>\n )}\n {resolvedTitle != null && <div className={styles.title}>{resolvedTitle}</div>}\n {description != null && <div className={styles.description}>{description}</div>}\n {action != null && <div className={styles.action}>{action}</div>}\n {children}\n </div>\n )\n})\n"],"names":["ICON_NAME_SET","ICON_NAMES","EmptyState","forwardRef","icon","title","description","action","size","pattern","className","children","props","ref","t","useT","resolvedTitle","renderedIcon","jsx","Icon","jsxs","clsx","styles"],"mappings":";;;;;;;;;;;;;;;;GASMA,IAAgB,IAAI,IAAYC,CAAU,GA4BnCC,IAAaC,EAA4C,SACpE,EAAE,MAAAC,GAAM,OAAAC,GAAO,aAAAC,GAAa,QAAAC,GAAQ,MAAAC,IAAO,MAAM,SAAAC,IAAU,IAAM,WAAAC,GAAW,UAAAC,GAAU,GAAGC,EAAA,GACzFC,GACA;AACA,QAAMC,IAAIC,EAAA,GACJC,IAAgBX,KAASS,EAAE,kBAAkB,GAC7CG,IACJb,MAAS,KAAQ,OAAOA,KAAQ,OAC9B,gBAAAc,EAACC,GAAA,EAAK,MAAK,aAAA,CAAa,IACtB,OAAOf,KAAS,YAAYJ,EAAc,IAAII,CAAI,IACpD,gBAAAc,EAACC,GAAA,EAAK,MAAMf,EAAA,CAAkB,IAE9BA;AAGJ,SACE,gBAAAgB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAP;AAAA,MACA,WAAWQ,EAAKC,EAAO,YAAYA,EAAOd,CAAI,GAAGC,KAAWa,EAAO,SAASZ,CAAS;AAAA,MACpF,GAAGE;AAAA,MAEH,UAAA;AAAA,QAAAK,KAAgB,0BACd,OAAA,EAAI,WAAWK,EAAO,MAAM,eAAW,IACrC,UAAAL,EAAA,CACH;AAAA,QAEDD,KAAiB,QAAQ,gBAAAE,EAAC,SAAI,WAAWI,EAAO,OAAQ,UAAAN,GAAc;AAAA,QACtEV,KAAe,QAAQ,gBAAAY,EAAC,SAAI,WAAWI,EAAO,aAAc,UAAAhB,GAAY;AAAA,QACxEC,KAAU,QAAQ,gBAAAW,EAAC,SAAI,WAAWI,EAAO,QAAS,UAAAf,GAAO;AAAA,QACzDI;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
@@ -0,0 +1,148 @@
1
+ import { jsxs as i, jsx as c } from "react/jsx-runtime";
2
+ import { forwardRef as O, useState as S, useEffect as L } from "react";
3
+ import { clsx as $ } from "clsx";
4
+ import { A as V } from "./Avatar-BJVCdo-K.js";
5
+ import { I as k } from "./IconButton-B8FPGgDn.js";
6
+ import { I as G } from "./Icon-CophpkHo.js";
7
+ import { a as y } from "./ConfigProvider-BYruQYHC.js";
8
+ const H = "_fileCard_1382m_3", K = "_avatar_1382m_24", R = "_body_1382m_29", U = "_name_1382m_38", W = "_nameBase_1382m_45", X = "_nameExt_1382m_51", z = "_type_1382m_56", J = "_download_1382m_63", P = "_sm_1382m_68", Q = "_md_1382m_79", Y = "_lg_1382m_83", o = {
9
+ fileCard: H,
10
+ avatar: K,
11
+ body: R,
12
+ name: U,
13
+ nameBase: W,
14
+ nameExt: X,
15
+ type: z,
16
+ download: J,
17
+ sm: P,
18
+ md: Q,
19
+ lg: Y
20
+ }, Z = /* @__PURE__ */ new Set([
21
+ "png",
22
+ "jpg",
23
+ "jpeg",
24
+ "webp",
25
+ "svg",
26
+ "gif",
27
+ "avif",
28
+ "bmp",
29
+ "ico",
30
+ "heic"
31
+ ]), ee = {
32
+ pdf: "DocumentText",
33
+ doc: "DocumentText",
34
+ docx: "DocumentText",
35
+ txt: "DocumentText",
36
+ rtf: "DocumentText",
37
+ md: "DocumentText",
38
+ csv: "DocumentText",
39
+ xls: "DocumentText",
40
+ xlsx: "DocumentText",
41
+ json: "DocumentCode",
42
+ xml: "DocumentCode",
43
+ zip: "Folder",
44
+ rar: "Folder",
45
+ "7z": "Folder",
46
+ mp4: "VideoSquare",
47
+ mov: "VideoSquare",
48
+ webm: "VideoSquare",
49
+ mp3: "MusicSquare",
50
+ wav: "MusicSquare"
51
+ };
52
+ function te(n, e) {
53
+ const t = n.lastIndexOf(".");
54
+ return t > 0 && n.length - t <= 7 ? n.slice(t + 1).toLowerCase() : e && e.includes("/") ? e.slice(e.indexOf("/") + 1).toLowerCase() : "";
55
+ }
56
+ function ne(n) {
57
+ const e = n.lastIndexOf(".");
58
+ return e > 0 && n.length - e <= 7 ? { base: n.slice(0, e), ext: n.slice(e) } : { base: n, ext: "" };
59
+ }
60
+ function v(n) {
61
+ if (!Number.isFinite(n) || n < 0) return "";
62
+ if (n < 1024) return `${n} B`;
63
+ const e = ["KB", "MB", "GB", "TB"];
64
+ let t = n / 1024, a = 0;
65
+ for (; t >= 1024 && a < e.length - 1; )
66
+ t /= 1024, a += 1;
67
+ return `${t < 10 ? t.toFixed(1) : Math.round(t)} ${e[a]}`;
68
+ }
69
+ const de = O(function({
70
+ name: e,
71
+ src: t,
72
+ type: a,
73
+ image: w,
74
+ fileSize: r,
75
+ fetchSize: u = !1,
76
+ meta: C,
77
+ color: f = "accent",
78
+ size: m = "md",
79
+ downloadable: b = !0,
80
+ onDownload: d,
81
+ className: T,
82
+ style: B,
83
+ ...D
84
+ }, N) {
85
+ const E = y(), l = te(e, a), _ = w ?? ((a == null ? void 0 : a.startsWith("image/")) || Z.has(l)), { base: I, ext: x } = ne(e), [h, F] = S(null);
86
+ L(() => {
87
+ if (!u || r != null || !t || typeof fetch > "u") return;
88
+ let s = !1;
89
+ return fetch(t, { method: "HEAD" }).then((A) => {
90
+ const g = A.headers.get("content-length");
91
+ !s && g && F(Number(g));
92
+ }).catch(() => {
93
+ }), () => {
94
+ s = !0;
95
+ };
96
+ }, [u, r, t]);
97
+ const j = r != null ? typeof r == "number" ? v(r) : r : h != null ? v(h) : "", q = [l ? l.toUpperCase() : "", j].filter(Boolean).join(" · "), p = C ?? (q || null), M = () => {
98
+ if (d) return d();
99
+ if (!t) return;
100
+ const s = document.createElement("a");
101
+ s.href = t, s.download = e, s.rel = "noopener", s.click();
102
+ };
103
+ return /* @__PURE__ */ i(
104
+ "div",
105
+ {
106
+ ref: N,
107
+ className: $(o.fileCard, o[m], T),
108
+ style: { "--tz-btn-rgb": `var(--tz-color-${f}-rgb)`, ...B },
109
+ ...D,
110
+ children: [
111
+ /* @__PURE__ */ c(
112
+ V,
113
+ {
114
+ className: o.avatar,
115
+ src: _ ? t : void 0,
116
+ icon: _ ? void 0 : ee[l] ?? "Document",
117
+ name: e,
118
+ shape: "square",
119
+ size: m,
120
+ color: f
121
+ }
122
+ ),
123
+ /* @__PURE__ */ i("div", { className: o.body, children: [
124
+ /* @__PURE__ */ i("span", { className: o.name, title: e, children: [
125
+ /* @__PURE__ */ c("span", { className: o.nameBase, children: I }),
126
+ x && /* @__PURE__ */ c("span", { className: o.nameExt, children: x })
127
+ ] }),
128
+ p != null && /* @__PURE__ */ c("span", { className: o.type, children: p })
129
+ ] }),
130
+ b && (t || d) && /* @__PURE__ */ c(
131
+ k,
132
+ {
133
+ variant: "filled",
134
+ size: m === "lg" ? "md" : "sm",
135
+ className: o.download,
136
+ "aria-label": E("fileCard.download", { name: e }),
137
+ onClick: M,
138
+ children: /* @__PURE__ */ c(G, { name: "ImportArrow" })
139
+ }
140
+ )
141
+ ]
142
+ }
143
+ );
144
+ });
145
+ export {
146
+ de as F
147
+ };
148
+ //# sourceMappingURL=FileCard-Cpc5frNm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileCard-Cpc5frNm.js","sources":["../src/components/FileCard/FileCard.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT, type ThemeColor } from '../../theme'\nimport { Avatar, type AvatarSize } from '../Avatar'\nimport { IconButton } from '../IconButton'\nimport { Icon } from '../Icon'\nimport type { IconName } from '../../icons/names'\nimport styles from './FileCard.module.css'\n\nexport type FileCardSize = AvatarSize\n\nconst IMAGE_EXTS = new Set([\n 'png',\n 'jpg',\n 'jpeg',\n 'webp',\n 'svg',\n 'gif',\n 'avif',\n 'bmp',\n 'ico',\n 'heic',\n])\n\n// a leading icon per file family (non-image); everything else gets the generic document icon\nconst FILE_ICONS: Record<string, IconName> = {\n pdf: 'DocumentText',\n doc: 'DocumentText',\n docx: 'DocumentText',\n txt: 'DocumentText',\n rtf: 'DocumentText',\n md: 'DocumentText',\n csv: 'DocumentText',\n xls: 'DocumentText',\n xlsx: 'DocumentText',\n json: 'DocumentCode',\n xml: 'DocumentCode',\n zip: 'Folder',\n rar: 'Folder',\n '7z': 'Folder',\n mp4: 'VideoSquare',\n mov: 'VideoSquare',\n webm: 'VideoSquare',\n mp3: 'MusicSquare',\n wav: 'MusicSquare',\n}\n\n/** The lowercased extension from a file name, else the subtype from a MIME `type` (`image/png` → `png`). */\nfunction extensionOf(name: string, type?: string): string {\n const dot = name.lastIndexOf('.')\n if (dot > 0 && name.length - dot <= 7) return name.slice(dot + 1).toLowerCase()\n if (type && type.includes('/')) return type.slice(type.indexOf('/') + 1).toLowerCase()\n return ''\n}\n\n/** Split `report.pdf` into `{ base: 'report', ext: '.pdf' }` so the base can ellipsize and the type stays. */\nfunction splitName(name: string): { base: string; ext: string } {\n const dot = name.lastIndexOf('.')\n return dot > 0 && name.length - dot <= 7\n ? { base: name.slice(0, dot), ext: name.slice(dot) }\n : { base: name, ext: '' }\n}\n\n/** Human-readable byte size — `2411724` → `\"2.3 MB\"`. */\nfunction formatBytes(bytes: number): string {\n if (!Number.isFinite(bytes) || bytes < 0) return ''\n if (bytes < 1024) return `${bytes} B`\n const units = ['KB', 'MB', 'GB', 'TB']\n let value = bytes / 1024\n let i = 0\n while (value >= 1024 && i < units.length - 1) {\n value /= 1024\n i += 1\n }\n return `${value < 10 ? value.toFixed(1) : Math.round(value)} ${units[i]}`\n}\n\nexport interface FileCardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'color'> {\n /** File name — shown middle-truncated (`test-file-na….pdf`) so the extension always stays visible. */\n name: string\n /** File URL — the download target and, for an image, the thumbnail `src`. */\n src?: string\n /** File type — an extension (`'pdf'`) or MIME (`'image/png'`). Derived from `name` when omitted. */\n type?: string\n /** Force image vs. file rendering. Inferred from `type` / `name` / `src` when omitted. */\n image?: boolean\n /** File size — a **bytes** number (auto-formatted to `\"2.3 MB\"`) or a preformatted string. Shown after the type. */\n fileSize?: number | string\n /**\n * When no `fileSize` is given, fetch it from `src` via a `HEAD` request (reads `Content-Length`). Off\n * by default — it's a network call and needs CORS to expose the header; prefer passing `fileSize` from\n * the backend. Fails silently (no size shown) when unavailable.\n */\n fetchSize?: boolean\n /** Meta line under the name — overrides the derived `TYPE · size`. */\n meta?: ReactNode\n /** Theme token tinting the avatar / file-icon box. Defaults to `accent`. */\n color?: ThemeColor\n /** Size — scales the avatar, text and padding. Defaults to `md`. */\n size?: FileCardSize\n /** Show the download control (only when there's a `src` or `onDownload`). Defaults to `true`. */\n downloadable?: boolean\n /** Custom download handler — replaces the default (a download of `src`). */\n onDownload?: () => void\n}\n\n/**\n * A compact, read-only **file card** for displaying a file that already exists (e.g. from the backend) —\n * an image or a document (`pdf` / `docx` / `csv` / `svg` / …). Shows a leading **`Avatar`** (the image\n * thumbnail via `src`, or a type-based file icon in a tinted square), the **name** middle-truncated so\n * the extension is never lost, the **type** underneath, and a **download** control. Simple to drop in —\n * pass `name` (+ `src` for the thumbnail/download). Not to be confused with `FileUploader` (which\n * *collects* files to upload); this only *displays* one. Token-only styling.\n *\n * @example\n * <FileCard name=\"annual-report.pdf\" src=\"/files/annual-report.pdf\" />\n * <FileCard name=\"avatar.png\" src={url} meta=\"240 KB\" />\n */\nexport const FileCard = forwardRef<HTMLDivElement, FileCardProps>(function FileCard(\n {\n name,\n src,\n type,\n image,\n fileSize,\n fetchSize = false,\n meta,\n color = 'accent',\n size = 'md',\n downloadable = true,\n onDownload,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const ext = extensionOf(name, type)\n const isImage = image ?? (type?.startsWith('image/') || IMAGE_EXTS.has(ext))\n const { base, ext: nameExt } = splitName(name)\n\n // optional auto size via a HEAD request (only when opted in and no explicit fileSize)\n const [fetchedSize, setFetchedSize] = useState<number | null>(null)\n useEffect(() => {\n if (!fetchSize || fileSize != null || !src || typeof fetch === 'undefined') return\n let cancelled = false\n fetch(src, { method: 'HEAD' })\n .then((res) => {\n const len = res.headers.get('content-length')\n if (!cancelled && len) setFetchedSize(Number(len))\n })\n .catch(() => {})\n return () => {\n cancelled = true\n }\n }, [fetchSize, fileSize, src])\n\n const sizeText =\n fileSize != null\n ? typeof fileSize === 'number'\n ? formatBytes(fileSize)\n : fileSize\n : fetchedSize != null\n ? formatBytes(fetchedSize)\n : ''\n // \"TYPE · 2.3 MB\" (either part optional) — overridden wholesale by `meta`\n const derivedMeta = [ext ? ext.toUpperCase() : '', sizeText].filter(Boolean).join(' · ')\n const metaLine = meta ?? (derivedMeta || null)\n\n const handleDownload = () => {\n if (onDownload) return onDownload()\n if (!src) return\n const a = document.createElement('a')\n a.href = src\n a.download = name\n a.rel = 'noopener'\n a.click()\n }\n\n return (\n <div\n ref={ref}\n className={clsx(styles.fileCard, styles[size], className)}\n style={{ '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`, ...style } as CSSProperties}\n {...props}\n >\n <Avatar\n className={styles.avatar}\n src={isImage ? src : undefined}\n icon={isImage ? undefined : (FILE_ICONS[ext] ?? 'Document')}\n name={name}\n shape=\"square\"\n size={size}\n color={color}\n />\n <div className={styles.body}>\n <span className={styles.name} title={name}>\n <span className={styles.nameBase}>{base}</span>\n {nameExt && <span className={styles.nameExt}>{nameExt}</span>}\n </span>\n {metaLine != null && <span className={styles.type}>{metaLine}</span>}\n </div>\n {downloadable && (src || onDownload) && (\n <IconButton\n variant=\"filled\"\n size={size === 'lg' ? 'md' : 'sm'}\n className={styles.download}\n aria-label={t('fileCard.download', { name })}\n onClick={handleDownload}\n >\n <Icon name=\"ImportArrow\" />\n </IconButton>\n )}\n </div>\n )\n})\n"],"names":["IMAGE_EXTS","FILE_ICONS","extensionOf","name","type","dot","splitName","formatBytes","bytes","units","value","i","FileCard","forwardRef","src","image","fileSize","fetchSize","meta","color","size","downloadable","onDownload","className","style","props","ref","t","useT","ext","isImage","base","nameExt","fetchedSize","setFetchedSize","useState","useEffect","cancelled","res","len","sizeText","derivedMeta","metaLine","handleDownload","a","jsxs","clsx","styles","jsx","Avatar","IconButton","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;GAkBMA,wBAAiB,IAAI;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC,GAGKC,KAAuC;AAAA,EAC3C,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA,EACL,KAAK;AAAA,EACL,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,MAAM;AAAA,EACN,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA,EACL,KAAK;AACP;AAGA,SAASC,GAAYC,GAAcC,GAAuB;AACxD,QAAMC,IAAMF,EAAK,YAAY,GAAG;AAChC,SAAIE,IAAM,KAAKF,EAAK,SAASE,KAAO,IAAUF,EAAK,MAAME,IAAM,CAAC,EAAE,YAAA,IAC9DD,KAAQA,EAAK,SAAS,GAAG,IAAUA,EAAK,MAAMA,EAAK,QAAQ,GAAG,IAAI,CAAC,EAAE,YAAA,IAClE;AACT;AAGA,SAASE,GAAUH,GAA6C;AAC9D,QAAME,IAAMF,EAAK,YAAY,GAAG;AAChC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AAA1B;AAAA,YACA,OAAM;AAAA,YACN,MAAAiB;AAAA,YACA,OAAAD;AAAA,UAAA;AAAA,QAAA;AAAA,QAEF,gBAAA0B,EAAC,OAAA,EAAI,WAAWE,EAAO,MACrB,UAAA;AAAA,UAAA,gBAAAF,EAAC,QAAA,EAAK,WAAWE,EAAO,MAAM,OAAO5C,GACnC,UAAA;AAAA,YAAA,gBAAA6C,EAAC,QAAA,EAAK,WAAWD,EAAO,UAAW,UAAAhB,GAAK;AAAA,YACvCC,KAAW,gBAAAgB,EAAC,QAAA,EAAK,WAAWD,EAAO,SAAU,UAAAf,EAAA,CAAQ;AAAA,UAAA,GACxD;AAAA,UACCU,KAAY,QAAQ,gBAAAM,EAAC,UAAK,WAAWD,EAAO,MAAO,UAAAL,EAAA,CAAS;AAAA,QAAA,GAC/D;AAAA,QACCrB,MAAiBP,KAAOQ,MACvB,gBAAA0B;AAAA,UAACE;AAAA,UAAA;AAAA,YACC,SAAQ;AAAA,YACR,MAAM9B,MAAS,OAAO,OAAO;AAAA,YAC7B,WAAW2B,EAAO;AAAA,YAClB,cAAYpB,EAAE,qBAAqB,EAAE,MAAAxB,GAAM;AAAA,YAC3C,SAASwC;AAAA,YAET,UAAA,gBAAAK,EAACG,GAAA,EAAK,MAAK,cAAA,CAAc;AAAA,UAAA;AAAA,QAAA;AAAA,MAC3B;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
@@ -0,0 +1,2 @@
1
+ "use strict";const o=require("react/jsx-runtime"),u=require("react"),O=require("clsx"),S=require("./Avatar-_ufXh3AY.cjs"),L=require("./IconButton-BoY2y_pV.cjs"),$=require("./Icon-CXTl_QAP.cjs"),V=require("./ConfigProvider-BHNx-NHV.cjs"),k="_fileCard_1382m_3",G="_avatar_1382m_24",R="_body_1382m_29",y="_name_1382m_38",H="_nameBase_1382m_45",K="_nameExt_1382m_51",P="_type_1382m_56",U="_download_1382m_63",W="_sm_1382m_68",X="_md_1382m_79",z="_lg_1382m_83",s={fileCard:k,avatar:G,body:R,name:y,nameBase:H,nameExt:K,type:P,download:U,sm:W,md:X,lg:z},J=new Set(["png","jpg","jpeg","webp","svg","gif","avif","bmp","ico","heic"]),Q={pdf:"DocumentText",doc:"DocumentText",docx:"DocumentText",txt:"DocumentText",rtf:"DocumentText",md:"DocumentText",csv:"DocumentText",xls:"DocumentText",xlsx:"DocumentText",json:"DocumentCode",xml:"DocumentCode",zip:"Folder",rar:"Folder","7z":"Folder",mp4:"VideoSquare",mov:"VideoSquare",webm:"VideoSquare",mp3:"MusicSquare",wav:"MusicSquare"};function Y(n,e){const t=n.lastIndexOf(".");return t>0&&n.length-t<=7?n.slice(t+1).toLowerCase():e&&e.includes("/")?e.slice(e.indexOf("/")+1).toLowerCase():""}function Z(n){const e=n.lastIndexOf(".");return e>0&&n.length-e<=7?{base:n.slice(0,e),ext:n.slice(e)}:{base:n,ext:""}}function p(n){if(!Number.isFinite(n)||n<0)return"";if(n<1024)return`${n} B`;const e=["KB","MB","GB","TB"];let t=n/1024,a=0;for(;t>=1024&&a<e.length-1;)t/=1024,a+=1;return`${t<10?t.toFixed(1):Math.round(t)} ${e[a]}`}const ee=u.forwardRef(function({name:e,src:t,type:a,image:C,fileSize:r,fetchSize:m=!1,meta:j,color:x="accent",size:d="md",downloadable:w=!0,onDownload:i,className:b,style:q,...B},T){const D=V.useT(),l=Y(e,a),f=C??((a==null?void 0:a.startsWith("image/"))||J.has(l)),{base:N,ext:_}=Z(e),[h,E]=u.useState(null);u.useEffect(()=>{if(!m||r!=null||!t||typeof fetch>"u")return;let c=!1;return fetch(t,{method:"HEAD"}).then(A=>{const g=A.headers.get("content-length");!c&&g&&E(Number(g))}).catch(()=>{}),()=>{c=!0}},[m,r,t]);const I=r!=null?typeof r=="number"?p(r):r:h!=null?p(h):"",F=[l?l.toUpperCase():"",I].filter(Boolean).join(" · "),v=j??(F||null),M=()=>{if(i)return i();if(!t)return;const c=document.createElement("a");c.href=t,c.download=e,c.rel="noopener",c.click()};return o.jsxs("div",{ref:T,className:O.clsx(s.fileCard,s[d],b),style:{"--tz-btn-rgb":`var(--tz-color-${x}-rgb)`,...q},...B,children:[o.jsx(S.Avatar,{className:s.avatar,src:f?t:void 0,icon:f?void 0:Q[l]??"Document",name:e,shape:"square",size:d,color:x}),o.jsxs("div",{className:s.body,children:[o.jsxs("span",{className:s.name,title:e,children:[o.jsx("span",{className:s.nameBase,children:N}),_&&o.jsx("span",{className:s.nameExt,children:_})]}),v!=null&&o.jsx("span",{className:s.type,children:v})]}),w&&(t||i)&&o.jsx(L.IconButton,{variant:"filled",size:d==="lg"?"md":"sm",className:s.download,"aria-label":D("fileCard.download",{name:e}),onClick:M,children:o.jsx($.Icon,{name:"ImportArrow"})})]})});exports.FileCard=ee;
2
+ //# sourceMappingURL=FileCard-CsGW2sxE.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileCard-CsGW2sxE.cjs","sources":["../src/components/FileCard/FileCard.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT, type ThemeColor } from '../../theme'\nimport { Avatar, type AvatarSize } from '../Avatar'\nimport { IconButton } from '../IconButton'\nimport { Icon } from '../Icon'\nimport type { IconName } from '../../icons/names'\nimport styles from './FileCard.module.css'\n\nexport type FileCardSize = AvatarSize\n\nconst IMAGE_EXTS = new Set([\n 'png',\n 'jpg',\n 'jpeg',\n 'webp',\n 'svg',\n 'gif',\n 'avif',\n 'bmp',\n 'ico',\n 'heic',\n])\n\n// a leading icon per file family (non-image); everything else gets the generic document icon\nconst FILE_ICONS: Record<string, IconName> = {\n pdf: 'DocumentText',\n doc: 'DocumentText',\n docx: 'DocumentText',\n txt: 'DocumentText',\n rtf: 'DocumentText',\n md: 'DocumentText',\n csv: 'DocumentText',\n xls: 'DocumentText',\n xlsx: 'DocumentText',\n json: 'DocumentCode',\n xml: 'DocumentCode',\n zip: 'Folder',\n rar: 'Folder',\n '7z': 'Folder',\n mp4: 'VideoSquare',\n mov: 'VideoSquare',\n webm: 'VideoSquare',\n mp3: 'MusicSquare',\n wav: 'MusicSquare',\n}\n\n/** The lowercased extension from a file name, else the subtype from a MIME `type` (`image/png` → `png`). */\nfunction extensionOf(name: string, type?: string): string {\n const dot = name.lastIndexOf('.')\n if (dot > 0 && name.length - dot <= 7) return name.slice(dot + 1).toLowerCase()\n if (type && type.includes('/')) return type.slice(type.indexOf('/') + 1).toLowerCase()\n return ''\n}\n\n/** Split `report.pdf` into `{ base: 'report', ext: '.pdf' }` so the base can ellipsize and the type stays. */\nfunction splitName(name: string): { base: string; ext: string } {\n const dot = name.lastIndexOf('.')\n return dot > 0 && name.length - dot <= 7\n ? { base: name.slice(0, dot), ext: name.slice(dot) }\n : { base: name, ext: '' }\n}\n\n/** Human-readable byte size — `2411724` → `\"2.3 MB\"`. */\nfunction formatBytes(bytes: number): string {\n if (!Number.isFinite(bytes) || bytes < 0) return ''\n if (bytes < 1024) return `${bytes} B`\n const units = ['KB', 'MB', 'GB', 'TB']\n let value = bytes / 1024\n let i = 0\n while (value >= 1024 && i < units.length - 1) {\n value /= 1024\n i += 1\n }\n return `${value < 10 ? value.toFixed(1) : Math.round(value)} ${units[i]}`\n}\n\nexport interface FileCardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'color'> {\n /** File name — shown middle-truncated (`test-file-na….pdf`) so the extension always stays visible. */\n name: string\n /** File URL — the download target and, for an image, the thumbnail `src`. */\n src?: string\n /** File type — an extension (`'pdf'`) or MIME (`'image/png'`). Derived from `name` when omitted. */\n type?: string\n /** Force image vs. file rendering. Inferred from `type` / `name` / `src` when omitted. */\n image?: boolean\n /** File size — a **bytes** number (auto-formatted to `\"2.3 MB\"`) or a preformatted string. Shown after the type. */\n fileSize?: number | string\n /**\n * When no `fileSize` is given, fetch it from `src` via a `HEAD` request (reads `Content-Length`). Off\n * by default — it's a network call and needs CORS to expose the header; prefer passing `fileSize` from\n * the backend. Fails silently (no size shown) when unavailable.\n */\n fetchSize?: boolean\n /** Meta line under the name — overrides the derived `TYPE · size`. */\n meta?: ReactNode\n /** Theme token tinting the avatar / file-icon box. Defaults to `accent`. */\n color?: ThemeColor\n /** Size — scales the avatar, text and padding. Defaults to `md`. */\n size?: FileCardSize\n /** Show the download control (only when there's a `src` or `onDownload`). Defaults to `true`. */\n downloadable?: boolean\n /** Custom download handler — replaces the default (a download of `src`). */\n onDownload?: () => void\n}\n\n/**\n * A compact, read-only **file card** for displaying a file that already exists (e.g. from the backend) —\n * an image or a document (`pdf` / `docx` / `csv` / `svg` / …). Shows a leading **`Avatar`** (the image\n * thumbnail via `src`, or a type-based file icon in a tinted square), the **name** middle-truncated so\n * the extension is never lost, the **type** underneath, and a **download** control. Simple to drop in —\n * pass `name` (+ `src` for the thumbnail/download). Not to be confused with `FileUploader` (which\n * *collects* files to upload); this only *displays* one. Token-only styling.\n *\n * @example\n * <FileCard name=\"annual-report.pdf\" src=\"/files/annual-report.pdf\" />\n * <FileCard name=\"avatar.png\" src={url} meta=\"240 KB\" />\n */\nexport const FileCard = forwardRef<HTMLDivElement, FileCardProps>(function FileCard(\n {\n name,\n src,\n type,\n image,\n fileSize,\n fetchSize = false,\n meta,\n color = 'accent',\n size = 'md',\n downloadable = true,\n onDownload,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const ext = extensionOf(name, type)\n const isImage = image ?? (type?.startsWith('image/') || IMAGE_EXTS.has(ext))\n const { base, ext: nameExt } = splitName(name)\n\n // optional auto size via a HEAD request (only when opted in and no explicit fileSize)\n const [fetchedSize, setFetchedSize] = useState<number | null>(null)\n useEffect(() => {\n if (!fetchSize || fileSize != null || !src || typeof fetch === 'undefined') return\n let cancelled = false\n fetch(src, { method: 'HEAD' })\n .then((res) => {\n const len = res.headers.get('content-length')\n if (!cancelled && len) setFetchedSize(Number(len))\n })\n .catch(() => {})\n return () => {\n cancelled = true\n }\n }, [fetchSize, fileSize, src])\n\n const sizeText =\n fileSize != null\n ? typeof fileSize === 'number'\n ? formatBytes(fileSize)\n : fileSize\n : fetchedSize != null\n ? formatBytes(fetchedSize)\n : ''\n // \"TYPE · 2.3 MB\" (either part optional) — overridden wholesale by `meta`\n const derivedMeta = [ext ? ext.toUpperCase() : '', sizeText].filter(Boolean).join(' · ')\n const metaLine = meta ?? (derivedMeta || null)\n\n const handleDownload = () => {\n if (onDownload) return onDownload()\n if (!src) return\n const a = document.createElement('a')\n a.href = src\n a.download = name\n a.rel = 'noopener'\n a.click()\n }\n\n return (\n <div\n ref={ref}\n className={clsx(styles.fileCard, styles[size], className)}\n style={{ '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`, ...style } as CSSProperties}\n {...props}\n >\n <Avatar\n className={styles.avatar}\n src={isImage ? src : undefined}\n icon={isImage ? undefined : (FILE_ICONS[ext] ?? 'Document')}\n name={name}\n shape=\"square\"\n size={size}\n color={color}\n />\n <div className={styles.body}>\n <span className={styles.name} title={name}>\n <span className={styles.nameBase}>{base}</span>\n {nameExt && <span className={styles.nameExt}>{nameExt}</span>}\n </span>\n {metaLine != null && <span className={styles.type}>{metaLine}</span>}\n </div>\n {downloadable && (src || onDownload) && (\n <IconButton\n variant=\"filled\"\n size={size === 'lg' ? 'md' : 'sm'}\n className={styles.download}\n aria-label={t('fileCard.download', { name })}\n onClick={handleDownload}\n >\n <Icon name=\"ImportArrow\" />\n </IconButton>\n )}\n </div>\n )\n})\n"],"names":["IMAGE_EXTS","FILE_ICONS","extensionOf","name","type","dot","splitName","formatBytes","bytes","units","value","i","FileCard","forwardRef","src","image","fileSize","fetchSize","meta","color","size","downloadable","onDownload","className","style","props","ref","t","useT","ext","isImage","base","nameExt","fetchedSize","setFetchedSize","useState","useEffect","cancelled","res","len","sizeText","derivedMeta","metaLine","handleDownload","a","jsxs","clsx","styles","jsx","Avatar","IconButton","Icon"],"mappings":"oiBAkBMA,MAAiB,IAAI,CACzB,MACA,MACA,OACA,OACA,MACA,MACA,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AAE,SAAWzC,EACbyC,EAAE,IAAM,WACRA,EAAE,MAAA,CACJ,EAEA,OACEC,EAAAA,KAAC,MAAA,CACC,IAAAnB,EACA,UAAWoB,EAAAA,KAAKC,EAAO,SAAUA,EAAO3B,CAAI,EAAGG,CAAS,EACxD,MAAO,CAAE,eAAgB,kBAAkBJ,CAAK,QAAS,GAAGK,CAAA,EAC3D,GAAGC,EAEJ,SAAA,CAAAuB,EAAAA,IAACC,EAAAA,OAAA,CACC,UAAWF,EAAO,OAClB,IAAKjB,EAAUhB,EAAM,OACrB,KAAMgB,EAAU,OAAa7B,EAAW4B,CAAG,GAAK,WAChD,KAAA1B,EACA,MAAM,SACN,KAAAiB,EACA,MAAAD,CAAA,CAAA,EAEF0B,EAAAA,KAAC,MAAA,CAAI,UAAWE,EAAO,KACrB,SAAA,CAAAF,OAAC,OAAA,CAAK,UAAWE,EAAO,KAAM,MAAO5C,EACnC,SAAA,CAAA6C,EAAAA,IAAC,OAAA,CAAK,UAAWD,EAAO,SAAW,SAAAhB,EAAK,EACvCC,GAAWgB,EAAAA,IAAC,OAAA,CAAK,UAAWD,EAAO,QAAU,SAAAf,CAAA,CAAQ,CAAA,EACxD,EACCU,GAAY,MAAQM,EAAAA,IAAC,QAAK,UAAWD,EAAO,KAAO,SAAAL,CAAA,CAAS,CAAA,EAC/D,EACCrB,IAAiBP,GAAOQ,IACvB0B,EAAAA,IAACE,EAAAA,WAAA,CACC,QAAQ,SACR,KAAM9B,IAAS,KAAO,KAAO,KAC7B,UAAW2B,EAAO,SAClB,aAAYpB,EAAE,oBAAqB,CAAE,KAAAxB,EAAM,EAC3C,QAASwC,EAET,SAAAK,EAAAA,IAACG,EAAAA,KAAA,CAAK,KAAK,aAAA,CAAc,CAAA,CAAA,CAC3B,CAAA,CAAA,CAIR,CAAC"}
@@ -11,10 +11,10 @@ import { t as Ge } from "./toastStore-Cx_JOKwS.js";
11
11
  import { I as R } from "./Icon-CophpkHo.js";
12
12
  import { T as se } from "./Typography-Cta6Rg4L.js";
13
13
  import qt from "react-image-crop";
14
- import { B as Ye } from "./Button-DhEv0YFk.js";
15
- import { M as Gt, O as Yt } from "./Modal-BuaPDlKV.js";
16
- import { T as Jt } from "./TextField-DMI1X09n.js";
17
- import { a as me, h as Qt } from "./ConfigProvider-2c94kUOk.js";
14
+ import { B as Ye } from "./Button-CUsXYM-m.js";
15
+ import { M as Gt, O as Yt } from "./Modal-XMRDPHvQ.js";
16
+ import { T as Jt } from "./TextField-Bg4TwkVD.js";
17
+ import { a as me, h as Qt } from "./ConfigProvider-BYruQYHC.js";
18
18
  import { f as xe } from "./TextField.module-QePvGeJ3.js";
19
19
  const Xt = "_cropSection_1j2zs_4", Zt = "_cropHead_1j2zs_10", eo = "_cropStage_1j2zs_16", to = "_crop_1j2zs_4", oo = "_cropImg_1j2zs_30", no = "_altFields_1j2zs_35", Y = {
20
20
  cropSection: Xt,
@@ -681,4 +681,4 @@ const hn = Dt(function({
681
681
  export {
682
682
  hn as F
683
683
  };
684
- //# sourceMappingURL=FileUploader-VtmmwUFE.js.map
684
+ //# sourceMappingURL=FileUploader-B_nKMh_K.js.map