eidos-ui 3.8.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/README.md +21 -11
  2. package/dist/{SegmentedControl.types-D_gHYL9X.d.cts → SegmentedControl.types-50fprBiO.d.cts} +9 -0
  3. package/dist/{SegmentedControl.types-CHtjABQM.d.ts → SegmentedControl.types-DKlamnBZ.d.ts} +9 -0
  4. package/dist/{ThemeProvider.types-DgXN0gEH.d.cts → ThemeProvider.types-CI9P1anY.d.cts} +53 -2
  5. package/dist/{ThemeProvider.types-DgXN0gEH.d.ts → ThemeProvider.types-CI9P1anY.d.ts} +53 -2
  6. package/dist/alert/index.cjs +5 -5
  7. package/dist/alert/index.js +4 -4
  8. package/dist/button/index.cjs +4 -4
  9. package/dist/button/index.js +3 -3
  10. package/dist/chip/index.cjs +4 -4
  11. package/dist/chip/index.js +3 -3
  12. package/dist/{chunk-V5CM5TH3.js → chunk-2OBOD3GO.js} +3 -3
  13. package/dist/{chunk-CFVUUMQA.cjs → chunk-2URFSWJT.cjs} +6 -8
  14. package/dist/chunk-2URFSWJT.cjs.map +1 -0
  15. package/dist/{chunk-4S57PE43.js → chunk-2WDL2ZVP.js} +6 -7
  16. package/dist/chunk-2WDL2ZVP.js.map +1 -0
  17. package/dist/{chunk-LWCFT5SP.cjs → chunk-3QBMSZSE.cjs} +3 -3
  18. package/dist/{chunk-LWCFT5SP.cjs.map → chunk-3QBMSZSE.cjs.map} +1 -1
  19. package/dist/{chunk-IC2PIK3E.js → chunk-43DJ3GGR.js} +4 -4
  20. package/dist/{chunk-L6ERHCQ2.js → chunk-57BVERWD.js} +3 -3
  21. package/dist/{chunk-AUNDBUHM.cjs → chunk-5HRVHEHE.cjs} +3 -3
  22. package/dist/{chunk-AUNDBUHM.cjs.map → chunk-5HRVHEHE.cjs.map} +1 -1
  23. package/dist/{chunk-6IB27I5K.cjs → chunk-6JYXGRJ3.cjs} +8 -8
  24. package/dist/{chunk-6IB27I5K.cjs.map → chunk-6JYXGRJ3.cjs.map} +1 -1
  25. package/dist/{chunk-NERASTO2.cjs → chunk-6ZFXIYH7.cjs} +3 -3
  26. package/dist/{chunk-NERASTO2.cjs.map → chunk-6ZFXIYH7.cjs.map} +1 -1
  27. package/dist/{chunk-IKXXXVUO.js → chunk-7TQUJ6BJ.js} +3 -3
  28. package/dist/{chunk-544RAXWO.cjs → chunk-7VMF6LIC.cjs} +19 -19
  29. package/dist/{chunk-544RAXWO.cjs.map → chunk-7VMF6LIC.cjs.map} +1 -1
  30. package/dist/{chunk-WTFEMOV5.cjs → chunk-ADB7QRX5.cjs} +16 -16
  31. package/dist/{chunk-WTFEMOV5.cjs.map → chunk-ADB7QRX5.cjs.map} +1 -1
  32. package/dist/{chunk-6CW5QSYV.cjs → chunk-AFGC62AL.cjs} +7 -7
  33. package/dist/{chunk-6CW5QSYV.cjs.map → chunk-AFGC62AL.cjs.map} +1 -1
  34. package/dist/{chunk-U4SVBE2M.js → chunk-AWPJH3UB.js} +4 -4
  35. package/dist/{chunk-V64DICJK.js → chunk-BHZ76J2K.js} +45 -33
  36. package/dist/chunk-BHZ76J2K.js.map +1 -0
  37. package/dist/{chunk-B2OHBIAL.cjs → chunk-BKUZF7CW.cjs} +10 -11
  38. package/dist/chunk-BKUZF7CW.cjs.map +1 -0
  39. package/dist/{chunk-WR77IZUU.cjs → chunk-BPVOQLCA.cjs} +7 -7
  40. package/dist/{chunk-WR77IZUU.cjs.map → chunk-BPVOQLCA.cjs.map} +1 -1
  41. package/dist/{chunk-MCPGI6EI.js → chunk-BUSMGQJ4.js} +2 -2
  42. package/dist/{chunk-H3C6YECZ.js → chunk-D2PXPX56.js} +6 -6
  43. package/dist/{chunk-L6YJ6QTZ.js → chunk-DCUIT7SI.js} +2 -2
  44. package/dist/{chunk-FE7S4RSK.js → chunk-DHOBGYRD.js} +164 -34
  45. package/dist/chunk-DHOBGYRD.js.map +1 -0
  46. package/dist/{chunk-JFV56ISS.cjs → chunk-E7BFBU6K.cjs} +45 -33
  47. package/dist/chunk-E7BFBU6K.cjs.map +1 -0
  48. package/dist/{chunk-HYRLK462.js → chunk-EDPCI2JC.js} +2 -2
  49. package/dist/{chunk-Z3IJWYUD.js → chunk-EJWEG66P.js} +226 -42
  50. package/dist/chunk-EJWEG66P.js.map +1 -0
  51. package/dist/{chunk-DPTTDHZ5.js → chunk-FAGQGGT3.js} +3 -3
  52. package/dist/{chunk-CNTG7OOO.js → chunk-FFYPSLQV.js} +12 -12
  53. package/dist/{chunk-7NUVLVSL.cjs → chunk-FJSK2RT7.cjs} +5 -5
  54. package/dist/{chunk-7NUVLVSL.cjs.map → chunk-FJSK2RT7.cjs.map} +1 -1
  55. package/dist/{chunk-P6OJQ2RN.js → chunk-FSX7DDLO.js} +8 -9
  56. package/dist/chunk-FSX7DDLO.js.map +1 -0
  57. package/dist/{chunk-XIUZT4TO.js → chunk-GE3QCXT7.js} +6 -7
  58. package/dist/chunk-GE3QCXT7.js.map +1 -0
  59. package/dist/{chunk-JY77VJAZ.js → chunk-GHUEVNNU.js} +3 -3
  60. package/dist/{chunk-4V2XYUQL.js → chunk-GLEPKX2R.js} +2 -2
  61. package/dist/{chunk-GZDT2AHJ.cjs → chunk-GRKC4PIX.cjs} +7 -7
  62. package/dist/{chunk-GZDT2AHJ.cjs.map → chunk-GRKC4PIX.cjs.map} +1 -1
  63. package/dist/{chunk-SLHIVEFW.cjs → chunk-HKLLKNRQ.cjs} +6 -9
  64. package/dist/chunk-HKLLKNRQ.cjs.map +1 -0
  65. package/dist/{chunk-2TIMJD4K.js → chunk-IBT535UH.js} +3 -3
  66. package/dist/{chunk-HR5MWA3B.cjs → chunk-IJW6YCJB.cjs} +5 -5
  67. package/dist/{chunk-HR5MWA3B.cjs.map → chunk-IJW6YCJB.cjs.map} +1 -1
  68. package/dist/{chunk-OGGZIFTI.cjs → chunk-JO4NDJRA.cjs} +192 -62
  69. package/dist/chunk-JO4NDJRA.cjs.map +1 -0
  70. package/dist/{chunk-NNAEQR3Y.cjs → chunk-K6VEUJLY.cjs} +30 -30
  71. package/dist/{chunk-NNAEQR3Y.cjs.map → chunk-K6VEUJLY.cjs.map} +1 -1
  72. package/dist/{chunk-F5IRMMZ2.cjs → chunk-K73JO4FK.cjs} +7 -7
  73. package/dist/{chunk-F5IRMMZ2.cjs.map → chunk-K73JO4FK.cjs.map} +1 -1
  74. package/dist/{chunk-4HZIXRAJ.cjs → chunk-KF2OGUAD.cjs} +11 -12
  75. package/dist/chunk-KF2OGUAD.cjs.map +1 -0
  76. package/dist/{chunk-TJQNGJHP.js → chunk-KLHC5BHS.js} +4 -4
  77. package/dist/{chunk-XWMXEJVZ.js → chunk-KZKBZ2AV.js} +5 -7
  78. package/dist/chunk-KZKBZ2AV.js.map +1 -0
  79. package/dist/{chunk-DG3O5NV4.cjs → chunk-LLHR6QW3.cjs} +3 -3
  80. package/dist/{chunk-DG3O5NV4.cjs.map → chunk-LLHR6QW3.cjs.map} +1 -1
  81. package/dist/{chunk-GDRLVX2A.js → chunk-LXRNFQEI.js} +4 -4
  82. package/dist/{chunk-VXC7Z7XB.cjs → chunk-MKQVDEHI.cjs} +5 -6
  83. package/dist/chunk-MKQVDEHI.cjs.map +1 -0
  84. package/dist/{chunk-TNQ2ZZ7W.cjs → chunk-MUMTPMWD.cjs} +7 -7
  85. package/dist/{chunk-TNQ2ZZ7W.cjs.map → chunk-MUMTPMWD.cjs.map} +1 -1
  86. package/dist/{chunk-RHWZX7PB.js → chunk-NONYIHXD.js} +4 -4
  87. package/dist/{chunk-XPG56DLQ.cjs → chunk-NSA7ASZ7.cjs} +8 -8
  88. package/dist/{chunk-XPG56DLQ.cjs.map → chunk-NSA7ASZ7.cjs.map} +1 -1
  89. package/dist/{chunk-6NAOAKII.js → chunk-NWFGXLQP.js} +2 -2
  90. package/dist/{chunk-H46ZLPNJ.cjs → chunk-O45W57Y4.cjs} +233 -49
  91. package/dist/chunk-O45W57Y4.cjs.map +1 -0
  92. package/dist/{chunk-UUT2VEN5.cjs → chunk-OC2OBBGM.cjs} +7 -8
  93. package/dist/chunk-OC2OBBGM.cjs.map +1 -0
  94. package/dist/{chunk-3X6QVHTD.js → chunk-OERK3T7E.js} +3 -4
  95. package/dist/chunk-OERK3T7E.js.map +1 -0
  96. package/dist/{chunk-ZJWQPZ7E.js → chunk-OQWG7NLI.js} +3 -11
  97. package/dist/chunk-OQWG7NLI.js.map +1 -0
  98. package/dist/{chunk-U34INRFO.js → chunk-PP6HS4GR.js} +5 -16
  99. package/dist/chunk-PP6HS4GR.js.map +1 -0
  100. package/dist/{chunk-ENMDOQQO.cjs → chunk-R5WI5IGR.cjs} +6 -17
  101. package/dist/{chunk-ENMDOQQO.cjs.map → chunk-R5WI5IGR.cjs.map} +1 -1
  102. package/dist/{chunk-UTYY35QX.cjs → chunk-RZMQCVAS.cjs} +3 -3
  103. package/dist/{chunk-UTYY35QX.cjs.map → chunk-RZMQCVAS.cjs.map} +1 -1
  104. package/dist/{chunk-7FV2X62W.cjs → chunk-SJKD3WCV.cjs} +7 -7
  105. package/dist/{chunk-7FV2X62W.cjs.map → chunk-SJKD3WCV.cjs.map} +1 -1
  106. package/dist/{chunk-LUDK44NZ.cjs → chunk-SJPCBRKR.cjs} +3 -3
  107. package/dist/{chunk-LUDK44NZ.cjs.map → chunk-SJPCBRKR.cjs.map} +1 -1
  108. package/dist/{chunk-3TF2GZSG.js → chunk-SONL2RCW.js} +7 -7
  109. package/dist/{chunk-2IXCEKLI.js → chunk-SOS4K7VC.js} +2 -2
  110. package/dist/{chunk-WHQGJHMD.js → chunk-TOLNPD7S.js} +4 -4
  111. package/dist/{chunk-FHOD3FUN.js → chunk-UTOTOWPS.js} +4 -4
  112. package/dist/{chunk-YIOHKQ6Y.cjs → chunk-VCG647BY.cjs} +5 -13
  113. package/dist/chunk-VCG647BY.cjs.map +1 -0
  114. package/dist/{chunk-HLI4SOH3.cjs → chunk-VGMRIXW4.cjs} +45 -45
  115. package/dist/{chunk-HLI4SOH3.cjs.map → chunk-VGMRIXW4.cjs.map} +1 -1
  116. package/dist/{chunk-N5NXKVFJ.cjs → chunk-VPN7AR7T.cjs} +10 -10
  117. package/dist/{chunk-N5NXKVFJ.cjs.map → chunk-VPN7AR7T.cjs.map} +1 -1
  118. package/dist/{chunk-6FXFKMJ5.js → chunk-XBIMNWE6.js} +3 -3
  119. package/dist/{chunk-3VXUOAIJ.cjs → chunk-XR72A66Q.cjs} +3 -7
  120. package/dist/chunk-XR72A66Q.cjs.map +1 -0
  121. package/dist/{chunk-ULKWUKD2.cjs → chunk-YHSCUPP6.cjs} +22 -23
  122. package/dist/chunk-YHSCUPP6.cjs.map +1 -0
  123. package/dist/{chunk-S5CMZFX6.js → chunk-YPEJH57Z.js} +6 -7
  124. package/dist/chunk-YPEJH57Z.js.map +1 -0
  125. package/dist/{chunk-BO3KK3ZQ.js → chunk-YPPG7NLW.js} +2 -6
  126. package/dist/chunk-YPPG7NLW.js.map +1 -0
  127. package/dist/{chunk-PE2SLXUS.cjs → chunk-YWXS4IPH.cjs} +5 -5
  128. package/dist/{chunk-PE2SLXUS.cjs.map → chunk-YWXS4IPH.cjs.map} +1 -1
  129. package/dist/{chunk-UC4NYF6T.js → chunk-YYA5SWXD.js} +2 -2
  130. package/dist/{chunk-IHPSRTVW.js → chunk-Z3OEYDNI.js} +4 -7
  131. package/dist/chunk-Z3OEYDNI.js.map +1 -0
  132. package/dist/{chunk-MKC6V3SY.cjs → chunk-Z6FZ7GI5.cjs} +6 -6
  133. package/dist/{chunk-MKC6V3SY.cjs.map → chunk-Z6FZ7GI5.cjs.map} +1 -1
  134. package/dist/{chunk-NFD7MPX4.cjs → chunk-ZVA5KJAJ.cjs} +11 -11
  135. package/dist/{chunk-NFD7MPX4.cjs.map → chunk-ZVA5KJAJ.cjs.map} +1 -1
  136. package/dist/color-picker/index.cjs +4 -4
  137. package/dist/color-picker/index.js +3 -3
  138. package/dist/combobox/index.cjs +6 -6
  139. package/dist/combobox/index.js +5 -5
  140. package/dist/command-palette/index.cjs +3 -3
  141. package/dist/command-palette/index.js +2 -2
  142. package/dist/context-menu/index.cjs +6 -6
  143. package/dist/context-menu/index.js +5 -5
  144. package/dist/conversation/index.cjs +8 -8
  145. package/dist/conversation/index.js +7 -7
  146. package/dist/data-grid/index.cjs +15 -15
  147. package/dist/data-grid/index.d.cts +1 -1
  148. package/dist/data-grid/index.d.ts +1 -1
  149. package/dist/data-grid/index.js +14 -14
  150. package/dist/date-picker/index.cjs +8 -8
  151. package/dist/date-picker/index.js +7 -7
  152. package/dist/drawer/index.cjs +5 -5
  153. package/dist/drawer/index.js +4 -4
  154. package/dist/dropdown/index.cjs +3 -3
  155. package/dist/dropdown/index.js +2 -2
  156. package/dist/header/index.cjs +6 -6
  157. package/dist/header/index.js +5 -5
  158. package/dist/index.cjs +39 -39
  159. package/dist/index.cjs.map +1 -1
  160. package/dist/index.css +345 -205
  161. package/dist/index.d.cts +2 -2
  162. package/dist/index.d.ts +2 -2
  163. package/dist/index.js +40 -40
  164. package/dist/inline-edit/index.cjs +5 -5
  165. package/dist/inline-edit/index.js +4 -4
  166. package/dist/input/index.cjs +4 -4
  167. package/dist/input/index.js +3 -3
  168. package/dist/menu/index.cjs +5 -5
  169. package/dist/menu/index.js +4 -4
  170. package/dist/modal/index.cjs +5 -5
  171. package/dist/modal/index.js +4 -4
  172. package/dist/navigation/index.cjs +5 -5
  173. package/dist/navigation/index.js +4 -4
  174. package/dist/number-input/index.cjs +2 -4
  175. package/dist/number-input/index.cjs.map +1 -1
  176. package/dist/number-input/index.js +1 -3
  177. package/dist/page-layout/index.cjs +12 -12
  178. package/dist/page-layout/index.js +11 -11
  179. package/dist/pagination/index.cjs +8 -8
  180. package/dist/pagination/index.js +7 -7
  181. package/dist/popover/index.cjs +3 -3
  182. package/dist/popover/index.d.cts +1 -3
  183. package/dist/popover/index.d.ts +1 -3
  184. package/dist/popover/index.js +2 -2
  185. package/dist/segmented-control/index.cjs +4 -4
  186. package/dist/segmented-control/index.d.cts +2 -2
  187. package/dist/segmented-control/index.d.ts +2 -2
  188. package/dist/segmented-control/index.js +3 -3
  189. package/dist/select/index.cjs +6 -6
  190. package/dist/select/index.js +5 -5
  191. package/dist/snackbar/index.cjs +5 -5
  192. package/dist/snackbar/index.js +4 -4
  193. package/dist/split-button/index.cjs +6 -6
  194. package/dist/split-button/index.js +5 -5
  195. package/dist/split-chip/index.cjs +5 -5
  196. package/dist/split-chip/index.js +4 -4
  197. package/dist/table/index.cjs +13 -13
  198. package/dist/table/index.js +12 -12
  199. package/dist/tabs/index.cjs +3 -3
  200. package/dist/tabs/index.js +2 -2
  201. package/dist/tag-input/index.cjs +6 -6
  202. package/dist/tag-input/index.js +5 -5
  203. package/dist/textarea/index.cjs +4 -4
  204. package/dist/textarea/index.js +3 -3
  205. package/dist/theme-editor/index.cjs +13 -11
  206. package/dist/theme-editor/index.cjs.map +1 -1
  207. package/dist/theme-editor/index.d.cts +1 -1
  208. package/dist/theme-editor/index.d.ts +1 -1
  209. package/dist/theme-editor/index.js +12 -10
  210. package/dist/theme-provider/index.cjs +3 -3
  211. package/dist/theme-provider/index.d.cts +2 -2
  212. package/dist/theme-provider/index.d.ts +2 -2
  213. package/dist/theme-provider/index.js +2 -2
  214. package/dist/toolbar/index.cjs +8 -8
  215. package/dist/toolbar/index.js +7 -7
  216. package/dist/tooltip/index.cjs +3 -3
  217. package/dist/tooltip/index.js +2 -2
  218. package/package.json +4 -2
  219. package/dist/chunk-3VXUOAIJ.cjs.map +0 -1
  220. package/dist/chunk-3X6QVHTD.js.map +0 -1
  221. package/dist/chunk-4HZIXRAJ.cjs.map +0 -1
  222. package/dist/chunk-4S57PE43.js.map +0 -1
  223. package/dist/chunk-B2OHBIAL.cjs.map +0 -1
  224. package/dist/chunk-BO3KK3ZQ.js.map +0 -1
  225. package/dist/chunk-CFVUUMQA.cjs.map +0 -1
  226. package/dist/chunk-FE7S4RSK.js.map +0 -1
  227. package/dist/chunk-H46ZLPNJ.cjs.map +0 -1
  228. package/dist/chunk-IHPSRTVW.js.map +0 -1
  229. package/dist/chunk-JFV56ISS.cjs.map +0 -1
  230. package/dist/chunk-OGGZIFTI.cjs.map +0 -1
  231. package/dist/chunk-P6OJQ2RN.js.map +0 -1
  232. package/dist/chunk-S5CMZFX6.js.map +0 -1
  233. package/dist/chunk-SLHIVEFW.cjs.map +0 -1
  234. package/dist/chunk-U34INRFO.js.map +0 -1
  235. package/dist/chunk-ULKWUKD2.cjs.map +0 -1
  236. package/dist/chunk-UUT2VEN5.cjs.map +0 -1
  237. package/dist/chunk-V64DICJK.js.map +0 -1
  238. package/dist/chunk-VXC7Z7XB.cjs.map +0 -1
  239. package/dist/chunk-XIUZT4TO.js.map +0 -1
  240. package/dist/chunk-XWMXEJVZ.js.map +0 -1
  241. package/dist/chunk-YIOHKQ6Y.cjs.map +0 -1
  242. package/dist/chunk-Z3IJWYUD.js.map +0 -1
  243. package/dist/chunk-ZJWQPZ7E.js.map +0 -1
  244. /package/dist/{chunk-V5CM5TH3.js.map → chunk-2OBOD3GO.js.map} +0 -0
  245. /package/dist/{chunk-IC2PIK3E.js.map → chunk-43DJ3GGR.js.map} +0 -0
  246. /package/dist/{chunk-L6ERHCQ2.js.map → chunk-57BVERWD.js.map} +0 -0
  247. /package/dist/{chunk-IKXXXVUO.js.map → chunk-7TQUJ6BJ.js.map} +0 -0
  248. /package/dist/{chunk-U4SVBE2M.js.map → chunk-AWPJH3UB.js.map} +0 -0
  249. /package/dist/{chunk-MCPGI6EI.js.map → chunk-BUSMGQJ4.js.map} +0 -0
  250. /package/dist/{chunk-H3C6YECZ.js.map → chunk-D2PXPX56.js.map} +0 -0
  251. /package/dist/{chunk-L6YJ6QTZ.js.map → chunk-DCUIT7SI.js.map} +0 -0
  252. /package/dist/{chunk-HYRLK462.js.map → chunk-EDPCI2JC.js.map} +0 -0
  253. /package/dist/{chunk-DPTTDHZ5.js.map → chunk-FAGQGGT3.js.map} +0 -0
  254. /package/dist/{chunk-CNTG7OOO.js.map → chunk-FFYPSLQV.js.map} +0 -0
  255. /package/dist/{chunk-JY77VJAZ.js.map → chunk-GHUEVNNU.js.map} +0 -0
  256. /package/dist/{chunk-4V2XYUQL.js.map → chunk-GLEPKX2R.js.map} +0 -0
  257. /package/dist/{chunk-2TIMJD4K.js.map → chunk-IBT535UH.js.map} +0 -0
  258. /package/dist/{chunk-TJQNGJHP.js.map → chunk-KLHC5BHS.js.map} +0 -0
  259. /package/dist/{chunk-GDRLVX2A.js.map → chunk-LXRNFQEI.js.map} +0 -0
  260. /package/dist/{chunk-RHWZX7PB.js.map → chunk-NONYIHXD.js.map} +0 -0
  261. /package/dist/{chunk-6NAOAKII.js.map → chunk-NWFGXLQP.js.map} +0 -0
  262. /package/dist/{chunk-3TF2GZSG.js.map → chunk-SONL2RCW.js.map} +0 -0
  263. /package/dist/{chunk-2IXCEKLI.js.map → chunk-SOS4K7VC.js.map} +0 -0
  264. /package/dist/{chunk-WHQGJHMD.js.map → chunk-TOLNPD7S.js.map} +0 -0
  265. /package/dist/{chunk-FHOD3FUN.js.map → chunk-UTOTOWPS.js.map} +0 -0
  266. /package/dist/{chunk-6FXFKMJ5.js.map → chunk-XBIMNWE6.js.map} +0 -0
  267. /package/dist/{chunk-UC4NYF6T.js.map → chunk-YYA5SWXD.js.map} +0 -0
@@ -12,16 +12,16 @@ var _chunkTROYIUDHcjs = require('./chunk-TROYIUDH.cjs');
12
12
  var _chunkKV3V2CPHcjs = require('./chunk-KV3V2CPH.cjs');
13
13
 
14
14
 
15
- var _chunkWR77IZUUcjs = require('./chunk-WR77IZUU.cjs');
15
+ var _chunkBPVOQLCAcjs = require('./chunk-BPVOQLCA.cjs');
16
16
 
17
17
 
18
- var _chunkN5NXKVFJcjs = require('./chunk-N5NXKVFJ.cjs');
18
+ var _chunkVPN7AR7Tcjs = require('./chunk-VPN7AR7T.cjs');
19
19
 
20
20
 
21
21
  var _chunkQ3GNKF74cjs = require('./chunk-Q3GNKF74.cjs');
22
22
 
23
23
 
24
- var _chunkXPG56DLQcjs = require('./chunk-XPG56DLQ.cjs');
24
+ var _chunkNSA7ASZ7cjs = require('./chunk-NSA7ASZ7.cjs');
25
25
 
26
26
  // src/components/Conversation/Chat.component.tsx
27
27
  var _react = require('react');
@@ -334,7 +334,7 @@ var MessageComposer = ({
334
334
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: replyingTo })
335
335
  ] }),
336
336
  onCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
337
- _chunkXPG56DLQcjs.Button,
337
+ _chunkNSA7ASZ7cjs.Button,
338
338
  {
339
339
  variant: "text",
340
340
  color: "secondary",
@@ -374,7 +374,7 @@ var MessageComposer = ({
374
374
  }
375
375
  ),
376
376
  attachments.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { className: "eidos-composer-attachments", children: attachments.map((file, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
377
- _chunkWR77IZUUcjs.Chip,
377
+ _chunkBPVOQLCAcjs.Chip,
378
378
  {
379
379
  size: "sm",
380
380
  variant: "outlined",
@@ -408,7 +408,7 @@ var MessageComposer = ({
408
408
  }
409
409
  ),
410
410
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
411
- _chunkXPG56DLQcjs.Button,
411
+ _chunkNSA7ASZ7cjs.Button,
412
412
  {
413
413
  variant: "text",
414
414
  color: "secondary",
@@ -432,7 +432,7 @@ var MessageComposer = ({
432
432
  ] }),
433
433
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "eidos-composer-actions-end", children: [
434
434
  onCancel && !replyingTo && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
435
- _chunkXPG56DLQcjs.Button,
435
+ _chunkNSA7ASZ7cjs.Button,
436
436
  {
437
437
  variant: "text",
438
438
  color: "secondary",
@@ -443,7 +443,7 @@ var MessageComposer = ({
443
443
  }
444
444
  ),
445
445
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
446
- _chunkXPG56DLQcjs.Button,
446
+ _chunkNSA7ASZ7cjs.Button,
447
447
  {
448
448
  type: "submit",
449
449
  size: "sm",
@@ -558,17 +558,17 @@ var MessageItem = ({
558
558
  status === "failed" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "eidos-message-status eidos-message-status--failed", children: [
559
559
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { "aria-hidden": "true" }),
560
560
  "Not sent",
561
- onRetry && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXPG56DLQcjs.Button, { variant: "text", color: "danger", size: "sm", preIcon: _lucidereact.RotateCw, onClick: onRetry, children: "Retry" })
561
+ onRetry && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNSA7ASZ7cjs.Button, { variant: "text", color: "danger", size: "sm", preIcon: _lucidereact.RotateCw, onClick: onRetry, children: "Retry" })
562
562
  ] }),
563
563
  footer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "eidos-message-footer", children: footer }),
564
- onReply && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "eidos-message-reply", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXPG56DLQcjs.Button, { variant: "text", color: "secondary", size: "sm", onClick: onReply, children: "Reply" }) })
564
+ onReply && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "eidos-message-reply", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNSA7ASZ7cjs.Button, { variant: "text", color: "secondary", size: "sm", onClick: onReply, children: "Reply" }) })
565
565
  ] }),
566
566
  hasActions && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "eidos-message-actions", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
567
- _chunkN5NXKVFJcjs.Menu,
567
+ _chunkVPN7AR7Tcjs.Menu,
568
568
  {
569
569
  items: _nullishCoalesce(actions, () => ( [])),
570
570
  trigger: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
571
- _chunkXPG56DLQcjs.Button,
571
+ _chunkNSA7ASZ7cjs.Button,
572
572
  {
573
573
  variant: "text",
574
574
  color: "secondary",
@@ -706,7 +706,7 @@ var Chat = ({
706
706
  hasMore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "eidos-chat-load-more", children: loadingMore ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "eidos-chat-loading-more", children: [
707
707
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTROYIUDHcjs.Spinner, { size: "sm", color: "secondary" }),
708
708
  "Loading earlier messages\u2026"
709
- ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXPG56DLQcjs.Button, { variant: "text", color: "secondary", size: "sm", onClick: onLoadMore, children: "Load earlier messages" }) }),
709
+ ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNSA7ASZ7cjs.Button, { variant: "text", color: "secondary", size: "sm", onClick: onLoadMore, children: "Load earlier messages" }) }),
710
710
  loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChatSkeleton, {}),
711
711
  isEmpty && (_nullishCoalesce(emptyContent, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
712
712
  _chunkKV3V2CPHcjs.EmptyState,
@@ -730,7 +730,7 @@ var Chat = ({
730
730
  }
731
731
  ),
732
732
  !atBottom && messages.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "eidos-chat-jump", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
733
- _chunkXPG56DLQcjs.Button,
733
+ _chunkNSA7ASZ7cjs.Button,
734
734
  {
735
735
  size: "sm",
736
736
  variant: "filled",
@@ -895,7 +895,7 @@ var CommentThread = ({
895
895
  hasMore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "eidos-comment-thread-load-more", children: loadingMore ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "eidos-comment-thread-loading-more", children: [
896
896
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTROYIUDHcjs.Spinner, { size: "sm", color: "secondary" }),
897
897
  "Loading more comments\u2026"
898
- ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXPG56DLQcjs.Button, { variant: "outlined", color: "secondary", size: "sm", onClick: onLoadMore, children: "Load more comments" }) }),
898
+ ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNSA7ASZ7cjs.Button, { variant: "outlined", color: "secondary", size: "sm", onClick: onLoadMore, children: "Load more comments" }) }),
899
899
  composerPosition === "bottom" && composer,
900
900
  readOnly && readOnlyMessage && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "eidos-conversation-readonly", children: readOnlyMessage })
901
901
  ] });
@@ -907,4 +907,4 @@ CommentThread.displayName = "CommentThread";
907
907
 
908
908
 
909
909
  exports.MessageComposer = MessageComposer; exports.Chat = Chat; exports.CommentThread = CommentThread;
910
- //# sourceMappingURL=chunk-WTFEMOV5.cjs.map
910
+ //# sourceMappingURL=chunk-ADB7QRX5.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/eidos-ui/eidos-ui/dist/chunk-WTFEMOV5.cjs","../src/components/Conversation/Chat.component.tsx","../src/components/Conversation/MessageComposer.component.tsx","../src/components/Conversation/Conversation.hooks.ts","../src/components/Conversation/Conversation.utils.ts","../src/components/Conversation/MessageItem.component.tsx","../src/components/Conversation/CommentThread.component.tsx"],"names":["useRef","useCallback","Fragment","Paperclip","jsx","jsxs"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;A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GMA,sBAAAA;AAAuC,MAAA;AAIzC,IAAA;AAOgB,IAAA;AAET,IAAA;AAGf,EAAA;AAEJ;AAEc;ANmqBW;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/eidos-ui/eidos-ui/dist/chunk-WTFEMOV5.cjs","sourcesContent":[null,"import React, { useCallback, useMemo } from 'react';\nimport { ArrowDown, MessagesSquare } from 'lucide-react';\nimport { Button } from '../Button';\nimport { EmptyState } from '../EmptyState';\nimport { Skeleton } from '../Skeleton';\nimport { Spinner } from '../Spinner';\nimport { MessageComposer } from './MessageComposer.component';\nimport { MessageItem } from './MessageItem.component';\nimport type { ChatProps, ConversationMessage } from './Conversation.types';\nimport {\n useLoadMoreOnScrollTop,\n useNewMessageIds,\n useScrollAnchor,\n useStickToBottom,\n} from './Conversation.hooks';\nimport { classNames, continuesRun, formatDateSeparator, isSameDay } from './Conversation.utils';\n\nconst ChatSkeleton: React.FC = () => (\n <div className=\"eidos-chat-skeleton\" aria-hidden=\"true\">\n {[0, 1, 2, 3].map((row) => (\n <div\n key={row}\n className={classNames(\n 'eidos-chat-skeleton-row',\n row % 2 === 1 && 'eidos-chat-skeleton-row--own',\n )}\n >\n <Skeleton variant=\"circular\" width={28} height={28} />\n <Skeleton variant=\"rounded\" height={48} />\n </div>\n ))}\n </div>\n);\n\n/**\n * A bottom-anchored message thread with a composer.\n *\n * Controlled and transport-agnostic: it renders the `messages` it is given and\n * reports intent through `onSend` / `onLoadMore`. It never fetches, so the\n * same array can be persisted and replayed verbatim.\n */\nexport const Chat: React.FC<ChatProps> = ({\n messages,\n currentUserId,\n onSend,\n onRetry,\n readOnly = false,\n readOnlyMessage,\n renderBody,\n messageActions,\n renderMessageFooter,\n loading = false,\n emptyContent,\n hasMore = false,\n loadingMore = false,\n onLoadMore,\n groupConsecutive = true,\n groupWindowMinutes = 5,\n showDateSeparators = true,\n formatTimestamp,\n animateNewMessages = true,\n allowAttachments = false,\n attachmentAccept,\n typing,\n unreadFromId,\n placeholder = 'Write a message...',\n sendOnEnter = true,\n ariaLabel = 'Conversation',\n className = '',\n}) => {\n const { scrollRef, contentRef, atBottom, scrollToBottom, handleScroll } =\n useStickToBottom(messages);\n const newIds = useNewMessageIds(messages, animateNewMessages);\n useScrollAnchor(scrollRef, messages);\n\n const loadMoreOnScroll = useLoadMoreOnScrollTop(scrollRef, { hasMore, loadingMore, onLoadMore });\n\n const onScroll = useCallback(() => {\n handleScroll();\n loadMoreOnScroll();\n }, [handleScroll, loadMoreOnScroll]);\n\n const byId = useMemo(() => new Map(messages.map((message) => [message.id, message])), [messages]);\n\n // An id that isn't in the current page must not draw a divider above\n // nothing - it would float at the top of whatever happens to be loaded.\n const unreadIndex = useMemo(() => {\n if (!unreadFromId) return -1;\n return messages.findIndex((message) => message.id === unreadFromId);\n }, [messages, unreadFromId]);\n\n const showComposer = !readOnly && Boolean(onSend);\n const isEmpty = !loading && messages.length === 0;\n\n const renderMessage = (message: ConversationMessage, index: number) => {\n const previous = messages[index - 1];\n const actions = readOnly ? undefined : messageActions?.(message);\n const quoted = message.parentId ? byId.get(message.parentId) : undefined;\n\n const nodes: React.ReactNode[] = [];\n\n if (showDateSeparators && (!previous || !isSameDay(previous.sentAt, message.sentAt))) {\n nodes.push(\n <li key={`date-${message.id}`} className=\"eidos-conversation-separator\">\n <span>{formatDateSeparator(message.sentAt)}</span>\n </li>,\n );\n }\n\n if (index === unreadIndex) {\n nodes.push(\n <li\n key={`unread-${message.id}`}\n className=\"eidos-conversation-separator eidos-conversation-separator--unread\"\n >\n <span>Unread messages</span>\n </li>,\n );\n }\n\n // A separator breaks a run: the message under it needs its own header.\n const grouped =\n groupConsecutive &&\n index !== unreadIndex &&\n nodes.length === 0 &&\n continuesRun(previous, message, groupWindowMinutes);\n\n nodes.push(\n <MessageItem\n key={message.id}\n message={message}\n layout=\"chat\"\n isOwn={Boolean(currentUserId) && message.author.id === currentUserId}\n grouped={grouped}\n isNew={newIds.has(message.id)}\n actions={actions}\n footer={renderMessageFooter?.(message)}\n body={renderBody?.(message)}\n onRetry={!readOnly && onRetry ? () => onRetry(message) : undefined}\n quoted={quoted}\n formatTimestamp={formatTimestamp}\n />,\n );\n\n return nodes;\n };\n\n return (\n <div className={classNames('eidos-chat', className)}>\n <div\n ref={scrollRef}\n className=\"eidos-chat-scroll\"\n onScroll={onScroll}\n role=\"log\"\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n aria-busy={loading}\n aria-label={ariaLabel}\n tabIndex={0}\n >\n {/* One wrapper whose height is the content height, so\n `useStickToBottom` can observe growth that doesn't change the\n message count - a streamed reply, the typing indicator. */}\n <div ref={contentRef} className=\"eidos-chat-scroll-content\">\n {hasMore && (\n <div className=\"eidos-chat-load-more\">\n {loadingMore ? (\n <span className=\"eidos-chat-loading-more\">\n <Spinner size=\"sm\" color=\"secondary\" />\n Loading earlier messages…\n </span>\n ) : (\n <Button variant=\"text\" color=\"secondary\" size=\"sm\" onClick={onLoadMore}>\n Load earlier messages\n </Button>\n )}\n </div>\n )}\n\n {loading && <ChatSkeleton />}\n\n {isEmpty &&\n (emptyContent ?? (\n <EmptyState\n icon={<MessagesSquare />}\n title=\"No messages yet\"\n description={\n showComposer ? 'Send the first message to start the conversation.' : undefined\n }\n size=\"sm\"\n />\n ))}\n\n {!loading && messages.length > 0 && (\n <ol className=\"eidos-conversation-list\">{messages.map(renderMessage)}</ol>\n )}\n\n {typing && typing.length > 0 && (\n <div className=\"eidos-chat-typing\" aria-live=\"polite\">\n <span className=\"eidos-chat-typing-dots\" aria-hidden=\"true\">\n <i />\n <i />\n <i />\n </span>\n {typing.length === 1\n ? `${typing[0].name} is typing…`\n : `${typing.length} people are typing…`}\n </div>\n )}\n </div>\n </div>\n\n {!atBottom && messages.length > 0 && (\n <div className=\"eidos-chat-jump\">\n <Button\n size=\"sm\"\n variant=\"filled\"\n color=\"secondary\"\n preIcon={ArrowDown}\n onClick={() => scrollToBottom('smooth')}\n >\n Latest\n </Button>\n </div>\n )}\n\n {showComposer && (\n <div className=\"eidos-chat-composer\">\n <MessageComposer\n onSubmit={onSend as NonNullable<typeof onSend>}\n placeholder={placeholder}\n sendOnEnter={sendOnEnter}\n allowAttachments={allowAttachments}\n attachmentAccept={attachmentAccept}\n />\n </div>\n )}\n\n {readOnly && readOnlyMessage && (\n <p className=\"eidos-conversation-readonly\">{readOnlyMessage}</p>\n )}\n </div>\n );\n};\n\nChat.displayName = 'Chat';\n","import React, { useCallback, useId, useRef, useState } from 'react';\nimport { Paperclip, Send, X } from 'lucide-react';\nimport { Avatar } from '../Avatar';\nimport { Button } from '../Button';\nimport { Chip } from '../Chip';\nimport type { MessageComposerProps } from './Conversation.types';\nimport { useAutoGrow } from './Conversation.hooks';\nimport { classNames, formatFileSize } from './Conversation.utils';\n\n/**\n * The authoring half of a conversation - a growing text field, optional\n * attachments, and a submit control.\n *\n * Exported on its own so a consumer building a bespoke list can still reuse\n * the input, and used internally by both `Chat` and `CommentThread`.\n */\nexport const MessageComposer: React.FC<MessageComposerProps> = ({\n value,\n onChange,\n onSubmit,\n onCancel,\n placeholder = 'Write a message...',\n submitLabel = 'Send',\n sendOnEnter = false,\n parentId,\n replyingTo,\n allowAttachments = false,\n attachmentAccept,\n author,\n disabled = false,\n requireBody = true,\n autoFocus = false,\n maxLength,\n className = '',\n}) => {\n const [internalBody, setInternalBody] = useState('');\n const [attachments, setAttachments] = useState<File[]>([]);\n const [pending, setPending] = useState(false);\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const fileInputId = useId();\n\n const isControlled = value !== undefined;\n const body = isControlled ? value : internalBody;\n\n useAutoGrow(textareaRef, body);\n\n const setBody = useCallback(\n (next: string) => {\n if (!isControlled) setInternalBody(next);\n onChange?.(next);\n },\n [isControlled, onChange],\n );\n\n const canSubmit = !disabled && !pending && (!requireBody || body.trim().length > 0);\n\n const submit = useCallback(async () => {\n if (!canSubmit) return;\n\n const draft = { body: body.trim(), attachments, parentId };\n const result = onSubmit(draft);\n\n // A synchronous handler clears immediately; an async one keeps the draft\n // until it resolves, so a rejected send never loses what was typed.\n if (!(result instanceof Promise)) {\n setBody('');\n setAttachments([]);\n return;\n }\n\n setPending(true);\n try {\n await result;\n setBody('');\n setAttachments([]);\n } catch {\n // Intentionally swallowed: the draft stays put and the consumer owns\n // error reporting (a Snackbar, an Alert, ...). Rethrowing here would\n // surface as an unhandled rejection from a keystroke.\n } finally {\n setPending(false);\n }\n }, [canSubmit, body, attachments, parentId, onSubmit, setBody]);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (!sendOnEnter) return;\n // Shift+Enter always inserts a newline; the modifier check also leaves\n // IME composition (which fires Enter to commit) alone.\n if (event.key !== 'Enter' || event.shiftKey || event.nativeEvent.isComposing) return;\n event.preventDefault();\n void submit();\n };\n\n const addFiles = (list: FileList | null) => {\n if (!list?.length) return;\n setAttachments((current) => [...current, ...Array.from(list)]);\n // Reset so selecting the same file twice in a row still fires `change`.\n if (fileInputRef.current) fileInputRef.current.value = '';\n };\n\n const removeAttachment = (index: number) =>\n setAttachments((current) => current.filter((_, i) => i !== index));\n\n return (\n <form\n className={classNames('eidos-message-composer', className)}\n onSubmit={(event) => {\n event.preventDefault();\n void submit();\n }}\n >\n {replyingTo && (\n <div className=\"eidos-composer-reply-hint\">\n <span>\n Replying to <strong>{replyingTo}</strong>\n </span>\n {onCancel && (\n <Button\n variant=\"text\"\n color=\"secondary\"\n size=\"sm\"\n icon={X}\n onClick={onCancel}\n tooltip=\"Cancel reply\"\n aria-label=\"Cancel reply\"\n />\n )}\n </div>\n )}\n\n <div className=\"eidos-composer-row\">\n {author && (\n <div className=\"eidos-composer-avatar\">\n <Avatar\n src={author.avatarSrc}\n name={author.name}\n size=\"sm\"\n color={author.avatarColor ?? 'gray'}\n />\n </div>\n )}\n\n <div className=\"eidos-composer-field\">\n <textarea\n ref={textareaRef}\n className=\"eidos-composer-input\"\n value={body}\n onChange={(event) => setBody(event.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled || pending}\n rows={1}\n maxLength={maxLength}\n // Opt-in and off by default. Only the reply composer sets it, where\n // the field appears in direct response to the user pressing Reply -\n // moving focus there is the expected outcome, not a hijack.\n autoFocus={autoFocus}\n aria-label={placeholder}\n />\n\n {attachments.length > 0 && (\n <ul className=\"eidos-composer-attachments\">\n {attachments.map((file, index) => (\n <li key={`${file.name}-${file.size}-${index}`}>\n <Chip\n size=\"sm\"\n variant=\"outlined\"\n color=\"secondary\"\n preIcon={Paperclip}\n onRemove={() => removeAttachment(index)}\n >\n {file.name}\n {file.size > 0 && ` (${formatFileSize(file.size)})`}\n </Chip>\n </li>\n ))}\n </ul>\n )}\n </div>\n </div>\n\n <div className=\"eidos-composer-actions\">\n <div className=\"eidos-composer-actions-start\">\n {allowAttachments && (\n <>\n <input\n ref={fileInputRef}\n id={fileInputId}\n type=\"file\"\n multiple\n accept={attachmentAccept}\n // Hidden from both the tab order and the accessibility\n // tree. It is a proxy: the visible button above opens the\n // file dialog via `.click()`, so this input is an\n // implementation detail, not a control.\n //\n // `visually-hidden` keeps an element *focusable* - that is\n // the point of it, for skip links and screen-reader-only\n // text - so a keyboard user landed on an invisible control\n // and met the same \"Attach files\" action twice. `FileUpload`\n // already gets this right with `display: none` +\n // `tabIndex={-1}`; these two had drifted from it.\n //\n // `aria-hidden` is safe here only *because* of the\n // `tabIndex={-1}` beside it - hiding a focusable element is\n // its own violation.\n className=\"eidos-composer-file-input\"\n tabIndex={-1}\n aria-hidden=\"true\"\n onChange={(event) => addFiles(event.target.files)}\n disabled={disabled || pending}\n />\n <Button\n variant=\"text\"\n color=\"secondary\"\n size=\"sm\"\n icon={Paperclip}\n tooltip=\"Attach files\"\n aria-label=\"Attach files\"\n disabled={disabled || pending}\n onClick={() => fileInputRef.current?.click()}\n />\n </>\n )}\n {sendOnEnter && (\n <span className=\"eidos-composer-hint\">\n <kbd>Enter</kbd> to send · <kbd>Shift</kbd>+<kbd>Enter</kbd> for a new line\n </span>\n )}\n </div>\n\n <div className=\"eidos-composer-actions-end\">\n {onCancel && !replyingTo && (\n <Button\n variant=\"text\"\n color=\"secondary\"\n size=\"sm\"\n onClick={onCancel}\n disabled={pending}\n >\n Cancel\n </Button>\n )}\n <Button\n type=\"submit\"\n size=\"sm\"\n color=\"primary\"\n preIcon={Send}\n loading={pending}\n disabled={!canSubmit}\n >\n {submitLabel}\n </Button>\n </div>\n </div>\n </form>\n );\n};\n\nMessageComposer.displayName = 'MessageComposer';\n","import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport type { ConversationMessage } from './Conversation.types';\n\n/**\n * Ids that arrived *after* the first render.\n *\n * Seeded from the first commit so an initial page of history is never\n * animated - otherwise opening a thread fades forty messages in at once,\n * which reads as a glitch rather than as feedback. Only genuinely new ids get\n * the entrance class, and each one only once.\n */\nexport const useNewMessageIds = (\n messages: ConversationMessage[],\n enabled: boolean,\n): Set<string> => {\n const seen = useRef<Set<string> | null>(null);\n const [fresh, setFresh] = useState<Set<string>>(() => new Set());\n\n useEffect(() => {\n // First commit: everything already on screen counts as pre-existing.\n if (seen.current === null) {\n seen.current = new Set(messages.map((message) => message.id));\n return;\n }\n\n if (!enabled) {\n for (const message of messages) seen.current.add(message.id);\n return;\n }\n\n const added = messages.filter((message) => !seen.current?.has(message.id));\n if (!added.length) return;\n\n for (const message of added) seen.current.add(message.id);\n setFresh(new Set(added.map((message) => message.id)));\n }, [messages, enabled]);\n\n return fresh;\n};\n\ninterface StickToBottom {\n scrollRef: React.RefObject<HTMLDivElement | null>;\n /**\n * The single element wrapping everything inside the scroll region. Its\n * height *is* the content height, so observing it catches every way the\n * content can grow.\n */\n contentRef: React.RefObject<HTMLDivElement | null>;\n /** The viewport is at (or near) the newest message. */\n atBottom: boolean;\n scrollToBottom: (behavior?: ScrollBehavior) => void;\n handleScroll: () => void;\n}\n\n/** Distance from the bottom still counted as \"reading the newest message\". */\nconst BOTTOM_THRESHOLD_PX = 48;\n\n/**\n * Keeps a bottom-anchored list pinned to the newest message - but only while\n * the reader is already there.\n *\n * Scrolling someone back down while they are reading scrollback is the single\n * most common defect in chat UIs, so arrival of a new message only forces a\n * scroll when `atBottom` was already true. Otherwise the caller surfaces a\n * jump-to-latest affordance and leaves the viewport alone.\n */\nexport const useStickToBottom = (messages: ConversationMessage[]): StickToBottom => {\n const scrollRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const [atBottom, setAtBottom] = useState(true);\n // Read during a layout effect, so it must not be state - it has to be\n // correct for the commit that is happening right now, not the next render.\n const atBottomRef = useRef(true);\n const lastCount = useRef(messages.length);\n const lastScrollTop = useRef(0);\n\n const scrollToBottom = useCallback((behavior: ScrollBehavior = 'smooth') => {\n const node = scrollRef.current;\n if (!node) return;\n node.scrollTo({ top: node.scrollHeight, behavior });\n }, []);\n\n // Stickiness is released only by the *reader* moving up, never by distance\n // alone.\n //\n // Measuring distance alone is wrong the moment content can grow while a\n // smooth scroll is in flight: the scroll events fired mid-animation report\n // the gap to a bottom that has since moved further away, so the reader - who\n // never touched anything - is declared \"not at the bottom\" and the thread\n // stops following a streamed reply partway through. A programmatic scroll\n // to the bottom only ever *increases* `scrollTop`, and content growth does\n // not change it at all, so a decrease is a reliable signal of intent: wheel,\n // keyboard, scrollbar drag and touch all produce one.\n const handleScroll = useCallback(() => {\n const node = scrollRef.current;\n if (!node) return;\n const distance = node.scrollHeight - node.scrollTop - node.clientHeight;\n const movedUp = node.scrollTop < lastScrollTop.current;\n lastScrollTop.current = node.scrollTop;\n\n let next = atBottomRef.current;\n if (distance <= BOTTOM_THRESHOLD_PX) next = true;\n else if (movedUp) next = false;\n\n atBottomRef.current = next;\n setAtBottom((current) => (current === next ? current : next));\n }, []);\n\n // Jump (not animate) to the bottom on first paint so a thread opens on its\n // newest message instead of visibly scrolling there.\n useLayoutEffect(() => {\n scrollToBottom('auto');\n // eslint-disable-next-line react-hooks/exhaustive-deps -- mount only\n }, []);\n\n useLayoutEffect(() => {\n if (messages.length > lastCount.current && atBottomRef.current) {\n scrollToBottom('smooth');\n }\n lastCount.current = messages.length;\n }, [messages.length, scrollToBottom]);\n\n // The effect above only reacts to the *number* of messages. A reply that is\n // streamed into an existing message - or a typing indicator appearing, or\n // an image loading - grows the content without changing that number, and\n // used to push the newest text below the fold while the reader was sitting\n // at the bottom waiting for it.\n //\n // Observing the content wrapper covers every one of those, because its\n // height is the content height. The scroll container itself cannot be\n // observed for this: its own box never changes size, only its\n // `scrollHeight` does.\n //\n // `'auto'`, not `'smooth'`: a stream grows the content once per token, and\n // a smooth scroll restarted that often never catches up with the text.\n // `atBottomRef` still holds the reader's position from *before* the growth,\n // which is exactly the question - \"were they following along?\".\n //\n // Growth that coincides with a new message is left to the smooth scroll the\n // layout effect above already started; jumping here as well would cancel\n // that animation on every single arrival.\n useEffect(() => {\n const content = contentRef.current;\n if (!content || typeof ResizeObserver === 'undefined') return;\n\n let lastHeight = content.getBoundingClientRect().height;\n let observedCount = lastCount.current;\n const observer = new ResizeObserver(() => {\n const height = content.getBoundingClientRect().height;\n const countChanged = observedCount !== lastCount.current;\n observedCount = lastCount.current;\n if (height > lastHeight && !countChanged && atBottomRef.current) scrollToBottom('auto');\n lastHeight = height;\n });\n observer.observe(content);\n return () => observer.disconnect();\n }, [scrollToBottom]);\n\n return { scrollRef, contentRef, atBottom, scrollToBottom, handleScroll };\n};\n\n/**\n * Preserves the reader's position when older messages are prepended.\n *\n * Without this, inserting a page above the viewport pushes the content the\n * user was reading down by the height of everything added, which reads as the\n * list jumping to a random place. Capturing `scrollHeight` before the DOM\n * mutation and restoring the delta in a *layout* effect corrects it before the\n * browser paints, so there is no visible shift.\n */\nexport const useScrollAnchor = (\n scrollRef: React.RefObject<HTMLDivElement | null>,\n messages: ConversationMessage[],\n): void => {\n const previous = useRef({ height: 0, firstId: '', count: 0 });\n\n useLayoutEffect(() => {\n const node = scrollRef.current;\n if (!node) return;\n\n const firstId = messages[0]?.id ?? '';\n const before = previous.current;\n // A prepend is the only case where the first id changes while the list\n // grows - an append leaves it untouched, and a replacement shrinks it.\n const prepended =\n before.firstId !== '' && before.firstId !== firstId && messages.length > before.count;\n\n if (prepended) {\n node.scrollTop += node.scrollHeight - before.height;\n }\n\n previous.current = { height: node.scrollHeight, firstId, count: messages.length };\n }, [messages, scrollRef]);\n};\n\n/**\n * Fires `onLoadMore` once the reader approaches the top of the history.\n *\n * Latched on the way in and released only after they scroll back out of the\n * trigger zone, so a single pause near the top can't queue a dozen fetches.\n */\nexport const useLoadMoreOnScrollTop = (\n scrollRef: React.RefObject<HTMLDivElement | null>,\n {\n hasMore,\n loadingMore,\n onLoadMore,\n }: {\n hasMore?: boolean;\n loadingMore?: boolean;\n onLoadMore?: () => void;\n },\n thresholdPx = 80,\n): (() => void) => {\n const armed = useRef(true);\n\n return useCallback(() => {\n const node = scrollRef.current;\n if (!node) return;\n\n if (node.scrollTop > thresholdPx) {\n armed.current = true;\n return;\n }\n\n if (!armed.current || !hasMore || loadingMore || !onLoadMore) return;\n armed.current = false;\n onLoadMore();\n }, [scrollRef, hasMore, loadingMore, onLoadMore, thresholdPx]);\n};\n\n/**\n * Grows a textarea to fit its content, up to `maxHeight`.\n *\n * Height is written to `style.height` directly rather than through a React\n * inline style: it is measured from the live DOM after every keystroke, so it\n * cannot be expressed as a class, and routing it through state would add a\n * render per character. Assigning the property imperatively also keeps it out\n * of the server-rendered `style` attribute that CSP's `style-src-attr` gates.\n */\nexport const useAutoGrow = (\n ref: React.RefObject<HTMLTextAreaElement | null>,\n value: string,\n maxHeight = 200,\n): void => {\n useLayoutEffect(() => {\n const node = ref.current;\n if (!node) return;\n\n node.style.height = 'auto';\n const next = Math.min(node.scrollHeight, maxHeight);\n node.style.height = `${next}px`;\n node.style.overflowY = node.scrollHeight > maxHeight ? 'auto' : 'hidden';\n }, [ref, value, maxHeight]);\n};\n","import type { ConversationMessage } from './Conversation.types';\n\n/**\n * Timestamp formatting goes through `Intl` rather than a date library on\n * purpose: `dayjs` is currently bundled only into the `DatePicker` chunk, and\n * pulling it in here would add it to every consumer importing a conversation.\n * `Intl` is built in and already locale-aware.\n */\n\nconst timeFormat = new Intl.DateTimeFormat(undefined, {\n hour: '2-digit',\n minute: '2-digit',\n});\n\nconst dateFormat = new Intl.DateTimeFormat(undefined, {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n});\n\nconst dateFormatSameYear = new Intl.DateTimeFormat(undefined, {\n day: 'numeric',\n month: 'long',\n});\n\n/** Parses an ISO string, returning null rather than an `Invalid Date`. */\nexport const parseDate = (iso: string): Date | null => {\n const date = new Date(iso);\n return Number.isNaN(date.getTime()) ? null : date;\n};\n\nexport const formatMessageTime = (iso: string): string => {\n const date = parseDate(iso);\n return date ? timeFormat.format(date) : iso;\n};\n\nconst startOfDay = (date: Date): number =>\n new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();\n\nexport const isSameDay = (a: string, b: string): boolean => {\n const first = parseDate(a);\n const second = parseDate(b);\n if (!first || !second) return false;\n return startOfDay(first) === startOfDay(second);\n};\n\n/** `Today` / `Yesterday` / a full date, for the divider between days. */\nexport const formatDateSeparator = (iso: string): string => {\n const date = parseDate(iso);\n if (!date) return iso;\n\n const now = new Date();\n const dayDelta = Math.round((startOfDay(now) - startOfDay(date)) / 86_400_000);\n\n if (dayDelta === 0) return 'Today';\n if (dayDelta === 1) return 'Yesterday';\n return date.getFullYear() === now.getFullYear()\n ? dateFormatSameYear.format(date)\n : dateFormat.format(date);\n};\n\nconst FILE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB'];\n\nexport const formatFileSize = (bytes: number): string => {\n if (!Number.isFinite(bytes) || bytes < 0) return '';\n if (bytes < 1024) return `${bytes} B`;\n\n let value = bytes;\n let unit = 0;\n while (value >= 1024 && unit < FILE_UNITS.length - 1) {\n value /= 1024;\n unit += 1;\n }\n // One decimal below 10 (9.4 MB), none above it (24 MB) - the extra digit\n // stops carrying information once the integer part is two digits.\n return `${value < 10 ? value.toFixed(1) : Math.round(value)} ${FILE_UNITS[unit]}`;\n};\n\n/**\n * Whether `message` continues a run started by `previous` - same author, same\n * day, and within the grouping window. A grouped message hides its avatar and\n * author line.\n */\nexport const continuesRun = (\n previous: ConversationMessage | undefined,\n message: ConversationMessage,\n windowMinutes: number,\n): boolean => {\n if (!previous) return false;\n if (previous.author.id !== message.author.id) return false;\n if (!isSameDay(previous.sentAt, message.sentAt)) return false;\n\n const before = parseDate(previous.sentAt);\n const after = parseDate(message.sentAt);\n if (!before || !after) return false;\n\n return Math.abs(after.getTime() - before.getTime()) <= windowMinutes * 60_000;\n};\n\nexport const sortBySentAt = (messages: ConversationMessage[]): ConversationMessage[] =>\n [...messages].sort((a, b) => {\n const first = parseDate(a.sentAt)?.getTime() ?? 0;\n const second = parseDate(b.sentAt)?.getTime() ?? 0;\n return first - second;\n });\n\nexport interface ThreadNode {\n message: ConversationMessage;\n replies: ConversationMessage[];\n}\n\n/**\n * Collapses a flat list into one level of nesting.\n *\n * Deeper chains are flattened onto the nearest **top-level** ancestor rather\n * than being dropped or nested further: indentation past one level is\n * unreadable on a phone, and silently discarding a reply-to-a-reply would lose\n * data the consumer stored. `replyingToName` on the rendered reply is what\n * preserves who was actually answered.\n *\n * A `parentId` pointing at a message that isn't present (paged out, deleted)\n * is treated as top-level, so nothing ever disappears from the list.\n */\nexport const buildThread = (messages: ConversationMessage[]): ThreadNode[] => {\n const byId = new Map(messages.map((message) => [message.id, message]));\n\n /** Walks up to the outermost ancestor, guarding against a parentId cycle. */\n const rootIdOf = (message: ConversationMessage): string => {\n const seen = new Set<string>([message.id]);\n let current = message;\n\n while (current.parentId) {\n const parent = byId.get(current.parentId);\n if (!parent || seen.has(parent.id)) break;\n seen.add(parent.id);\n current = parent;\n }\n\n return current.id;\n };\n\n const nodes = new Map<string, ThreadNode>();\n const roots: ThreadNode[] = [];\n\n for (const message of messages) {\n if (message.parentId && byId.has(message.parentId)) continue;\n const node: ThreadNode = { message, replies: [] };\n nodes.set(message.id, node);\n roots.push(node);\n }\n\n for (const message of messages) {\n if (!message.parentId || !byId.has(message.parentId)) continue;\n nodes.get(rootIdOf(message))?.replies.push(message);\n }\n\n for (const node of nodes.values()) {\n node.replies = sortBySentAt(node.replies);\n }\n\n return roots;\n};\n\n/** Name of the author a reply was addressed to, when it isn't its own parent. */\nexport const replyTargetName = (\n message: ConversationMessage,\n byId: Map<string, ConversationMessage>,\n rootId: string,\n): string | undefined => {\n if (!message.parentId || message.parentId === rootId) return undefined;\n return byId.get(message.parentId)?.author.name;\n};\n\n/** Trims a quoted excerpt so a long parent message can't dominate the reply. */\nexport const excerpt = (body: string, maxLength = 120): string => {\n const flat = body.replace(/\\s+/g, ' ').trim();\n return flat.length > maxLength ? `${flat.slice(0, maxLength - 1)}…` : flat;\n};\n\nexport const classNames = (...values: Array<string | false | null | undefined>): string =>\n values.filter(Boolean).join(' ');\n","import React from 'react';\nimport { AlertCircle, MoreHorizontal, Paperclip, RotateCw } from 'lucide-react';\nimport { Avatar } from '../Avatar';\nimport { Button } from '../Button';\nimport { Menu } from '../Menu';\nimport { Pill } from '../Pill';\nimport { Spinner } from '../Spinner';\nimport type { ConversationMessage, MessageAttachment } from './Conversation.types';\nimport type { MenuItemType } from '../Menu';\nimport { classNames, excerpt, formatFileSize, formatMessageTime } from './Conversation.utils';\n\nexport interface MessageItemProps {\n message: ConversationMessage;\n /** 'chat' right-aligns own messages into bubbles; 'comment' renders a flat card. */\n layout: 'chat' | 'comment';\n isOwn: boolean;\n /** Continues a run from the same author - hides the avatar and author line. */\n grouped: boolean;\n /** Plays the entrance animation. */\n isNew: boolean;\n actions?: MenuItemType[];\n footer?: React.ReactNode;\n body?: React.ReactNode;\n onRetry?: () => void;\n /** Author of the message being answered, for a flattened deep reply. */\n replyingToName?: string;\n /** Quoted parent, rendered above the body in chat layout. */\n quoted?: ConversationMessage;\n /** Reply affordance; omitted entirely when the viewer may not reply. */\n onReply?: () => void;\n formatTimestamp?: (iso: string) => string;\n}\n\nconst AttachmentList: React.FC<{ attachments: MessageAttachment[] }> = ({ attachments }) => (\n <ul className=\"eidos-message-attachments\">\n {attachments.map((attachment) => {\n const label = (\n <>\n <Paperclip aria-hidden=\"true\" />\n <span className=\"eidos-message-attachment-name\">{attachment.name}</span>\n {attachment.size !== undefined && (\n <span className=\"eidos-message-attachment-size\">{formatFileSize(attachment.size)}</span>\n )}\n </>\n );\n\n return (\n <li key={attachment.id} className=\"eidos-message-attachment\">\n {attachment.url ? (\n <a\n href={attachment.url}\n className=\"eidos-message-attachment-link\"\n target=\"_blank\"\n rel=\"noreferrer\"\n download={attachment.name}\n >\n {label}\n </a>\n ) : (\n <span className=\"eidos-message-attachment-link\">{label}</span>\n )}\n </li>\n );\n })}\n </ul>\n);\n\nexport const MessageItem: React.FC<MessageItemProps> = ({\n message,\n layout,\n isOwn,\n grouped,\n isNew,\n actions,\n footer,\n body,\n onRetry,\n replyingToName,\n quoted,\n onReply,\n formatTimestamp,\n}) => {\n const { author, status = 'sent' } = message;\n const timestamp = formatTimestamp\n ? formatTimestamp(message.sentAt)\n : formatMessageTime(message.sentAt);\n // An empty action list must not leave a dead trigger behind - see the\n // permissions note in Conversation.types.ts.\n const hasActions = Boolean(actions && actions.length > 0);\n\n // One placement per layout, rather than one per message.\n //\n // `chat` puts the time at the foot of the bubble, where a grouped message\n // already had it; it used to appear in the header for the first message of a\n // group and inside the bubble for the rest, so a single thread showed the\n // same fact in two places. `comment` keeps it in the header, where the row is\n // full width and has space for it.\n const timeInBubble = layout === 'chat';\n\n return (\n <li\n className={classNames(\n 'eidos-message',\n `eidos-message--${layout}`,\n isOwn && 'eidos-message--own',\n grouped && 'eidos-message--grouped',\n status !== 'sent' && `eidos-message--${status}`,\n isNew && 'eidos-message--enter',\n )}\n data-message-id={message.id}\n >\n <div className=\"eidos-message-avatar\">\n {!grouped && (\n <Avatar\n src={author.avatarSrc}\n name={author.name}\n size=\"sm\"\n color={author.avatarColor ?? 'gray'}\n />\n )}\n </div>\n\n <div className=\"eidos-message-main\">\n {!grouped && (\n <div className=\"eidos-message-header\">\n <span className=\"eidos-message-author\">{author.name}</span>\n {author.role && (\n <Pill size=\"sm\" variant=\"outlined\" color=\"secondary\">\n {author.role}\n </Pill>\n )}\n {!timeInBubble && (\n <time className=\"eidos-message-time\" dateTime={message.sentAt}>\n {timestamp}\n </time>\n )}\n {message.edited && <span className=\"eidos-message-edited\">edited</span>}\n </div>\n )}\n\n <div className=\"eidos-message-bubble\">\n {quoted && (\n <blockquote className=\"eidos-message-quote\">\n <span className=\"eidos-message-quote-author\">{quoted.author.name}</span>\n <span className=\"eidos-message-quote-body\">{excerpt(quoted.body)}</span>\n </blockquote>\n )}\n\n {replyingToName && (\n <span className=\"eidos-message-reply-target\">Replying to {replyingToName}</span>\n )}\n\n <div className=\"eidos-message-body\">{body ?? message.body}</div>\n\n {message.attachments && message.attachments.length > 0 && (\n <AttachmentList attachments={message.attachments} />\n )}\n\n {(timeInBubble || grouped) && (\n <time\n className=\"eidos-message-time eidos-message-time--inline\"\n dateTime={message.sentAt}\n >\n {timestamp}\n </time>\n )}\n </div>\n\n {status === 'sending' && (\n <span className=\"eidos-message-status\">\n <Spinner size=\"sm\" color=\"secondary\" />\n Sending…\n </span>\n )}\n\n {status === 'failed' && (\n <span className=\"eidos-message-status eidos-message-status--failed\">\n <AlertCircle aria-hidden=\"true\" />\n Not sent\n {onRetry && (\n <Button variant=\"text\" color=\"danger\" size=\"sm\" preIcon={RotateCw} onClick={onRetry}>\n Retry\n </Button>\n )}\n </span>\n )}\n\n {footer && <div className=\"eidos-message-footer\">{footer}</div>}\n\n {onReply && (\n <div className=\"eidos-message-reply\">\n <Button variant=\"text\" color=\"secondary\" size=\"sm\" onClick={onReply}>\n Reply\n </Button>\n </div>\n )}\n </div>\n\n {hasActions && (\n <div className=\"eidos-message-actions\">\n <Menu\n items={actions ?? []}\n trigger={\n <Button\n variant=\"text\"\n color=\"secondary\"\n size=\"sm\"\n icon={MoreHorizontal}\n aria-label={`Actions for ${author.name}'s message`}\n />\n }\n />\n </div>\n )}\n </li>\n );\n};\n\nMessageItem.displayName = 'MessageItem';\n","import React, { useCallback, useMemo, useState } from 'react';\nimport { MessageSquare } from 'lucide-react';\nimport { Button } from '../Button';\nimport { EmptyState } from '../EmptyState';\nimport { Skeleton } from '../Skeleton';\nimport { Spinner } from '../Spinner';\nimport { MessageComposer } from './MessageComposer.component';\nimport { MessageItem } from './MessageItem.component';\nimport type { CommentThreadProps, ConversationMessage, MessageDraft } from './Conversation.types';\nimport { useNewMessageIds } from './Conversation.hooks';\nimport {\n buildThread,\n classNames,\n continuesRun,\n replyTargetName,\n sortBySentAt,\n} from './Conversation.utils';\n\nconst CommentSkeleton: React.FC = () => (\n <div className=\"eidos-comment-thread-skeleton\" aria-hidden=\"true\">\n {[0, 1, 2].map((row) => (\n <div key={row} className=\"eidos-comment-thread-skeleton-row\">\n <Skeleton variant=\"circular\" width={28} height={28} />\n <Skeleton variant=\"text\" lines={2} />\n </div>\n ))}\n </div>\n);\n\n/**\n * A comment section: document flow, no internal scroll container, one level of\n * nesting.\n *\n * Shares its data model and message rendering with `Chat`, so history captured\n * in one can be displayed in the other. Unlike `Chat` it has no scroll region\n * of its own - it grows with the page and pages *downward* via `onLoadMore`.\n */\nexport const CommentThread: React.FC<CommentThreadProps> = ({\n messages,\n currentUserId,\n onSend,\n onReply,\n onRetry,\n readOnly = false,\n readOnlyMessage,\n renderBody,\n messageActions,\n renderMessageFooter,\n loading = false,\n emptyContent,\n hasMore = false,\n loadingMore = false,\n onLoadMore,\n groupConsecutive = true,\n groupWindowMinutes = 5,\n formatTimestamp,\n animateNewMessages = true,\n allowAttachments = false,\n attachmentAccept,\n order = 'oldest-first',\n composerPosition = 'bottom',\n placeholder = 'Add a comment...',\n sendOnEnter = false,\n title,\n ariaLabel = 'Comments',\n className = '',\n}) => {\n const [replyingToId, setReplyingToId] = useState<string | null>(null);\n const newIds = useNewMessageIds(messages, animateNewMessages);\n\n const byId = useMemo(() => new Map(messages.map((message) => [message.id, message])), [messages]);\n\n const roots = useMemo(() => {\n const thread = buildThread(messages);\n const sorted = sortBySentAt(thread.map((node) => node.message));\n const ordered = order === 'newest-first' ? [...sorted].reverse() : sorted;\n const nodeById = new Map(thread.map((node) => [node.message.id, node]));\n // Replies always read oldest-first, even when roots are reversed - a\n // conversation under a single comment is chronological by nature.\n return ordered.map((message) => nodeById.get(message.id)!);\n }, [messages, order]);\n\n const canReply = !readOnly && Boolean(onReply);\n const showComposer = !readOnly && Boolean(onSend);\n const isEmpty = !loading && messages.length === 0;\n const total = messages.length;\n\n const handleReply = useCallback(\n async (draft: MessageDraft) => {\n await onReply?.(draft);\n setReplyingToId(null);\n },\n [onReply],\n );\n\n const renderComment = (\n message: ConversationMessage,\n options: { rootId: string; previous?: ConversationMessage; isReply: boolean },\n ) => {\n const actions = readOnly ? undefined : messageActions?.(message);\n\n return (\n <MessageItem\n key={message.id}\n message={message}\n layout=\"comment\"\n isOwn={Boolean(currentUserId) && message.author.id === currentUserId}\n grouped={groupConsecutive && continuesRun(options.previous, message, groupWindowMinutes)}\n isNew={newIds.has(message.id)}\n actions={actions}\n footer={renderMessageFooter?.(message)}\n body={renderBody?.(message)}\n onRetry={!readOnly && onRetry ? () => onRetry(message) : undefined}\n replyingToName={\n options.isReply ? replyTargetName(message, byId, options.rootId) : undefined\n }\n onReply={canReply ? () => setReplyingToId(message.id) : undefined}\n formatTimestamp={formatTimestamp}\n />\n );\n };\n\n const composer = showComposer && (\n <MessageComposer\n onSubmit={onSend as NonNullable<typeof onSend>}\n placeholder={placeholder}\n submitLabel=\"Comment\"\n sendOnEnter={sendOnEnter}\n allowAttachments={allowAttachments}\n attachmentAccept={attachmentAccept}\n className=\"eidos-comment-thread-composer\"\n />\n );\n\n return (\n <section className={classNames('eidos-comment-thread', className)} aria-label={ariaLabel}>\n {(title || total > 0) && (\n <header className=\"eidos-comment-thread-header\">\n {title && <h3 className=\"eidos-comment-thread-title\">{title}</h3>}\n {total > 0 && (\n <span className=\"eidos-comment-thread-count\">\n {total} {total === 1 ? 'comment' : 'comments'}\n </span>\n )}\n </header>\n )}\n\n {composerPosition === 'top' && composer}\n\n {loading && <CommentSkeleton />}\n\n {isEmpty &&\n (emptyContent ?? (\n <EmptyState\n icon={<MessageSquare />}\n title=\"No comments yet\"\n description={showComposer ? 'Start the discussion by leaving a comment.' : undefined}\n size=\"sm\"\n />\n ))}\n\n {!loading && roots.length > 0 && (\n <ol className=\"eidos-conversation-list eidos-comment-thread-list\" aria-busy={loadingMore}>\n {roots.map((node) => (\n <li key={node.message.id} className=\"eidos-comment-thread-node\">\n <ol className=\"eidos-conversation-list\">\n {renderComment(node.message, { rootId: node.message.id, isReply: false })}\n </ol>\n\n {node.replies.length > 0 && (\n <ol className=\"eidos-conversation-list eidos-comment-thread-replies\">\n {node.replies.map((reply, index) =>\n renderComment(reply, {\n rootId: node.message.id,\n previous: node.replies[index - 1],\n isReply: true,\n }),\n )}\n </ol>\n )}\n\n {replyingToId &&\n (replyingToId === node.message.id ||\n node.replies.some((reply) => reply.id === replyingToId)) && (\n <div className=\"eidos-comment-thread-reply-composer\">\n <MessageComposer\n onSubmit={handleReply}\n onCancel={() => setReplyingToId(null)}\n parentId={replyingToId}\n replyingTo={byId.get(replyingToId)?.author.name}\n placeholder=\"Write a reply...\"\n submitLabel=\"Reply\"\n sendOnEnter={sendOnEnter}\n allowAttachments={allowAttachments}\n attachmentAccept={attachmentAccept}\n autoFocus\n />\n </div>\n )}\n </li>\n ))}\n </ol>\n )}\n\n {hasMore && (\n <div className=\"eidos-comment-thread-load-more\">\n {loadingMore ? (\n <span className=\"eidos-comment-thread-loading-more\">\n <Spinner size=\"sm\" color=\"secondary\" />\n Loading more comments…\n </span>\n ) : (\n <Button variant=\"outlined\" color=\"secondary\" size=\"sm\" onClick={onLoadMore}>\n Load more comments\n </Button>\n )}\n </div>\n )}\n\n {composerPosition === 'bottom' && composer}\n\n {readOnly && readOnlyMessage && (\n <p className=\"eidos-conversation-readonly\">{readOnlyMessage}</p>\n )}\n </section>\n );\n};\n\nCommentThread.displayName = 'CommentThread';\n"]}
1
+ {"version":3,"sources":["/home/runner/work/eidos-ui/eidos-ui/dist/chunk-ADB7QRX5.cjs","../src/components/Conversation/Chat.component.tsx","../src/components/Conversation/MessageComposer.component.tsx","../src/components/Conversation/Conversation.hooks.ts","../src/components/Conversation/Conversation.utils.ts","../src/components/Conversation/MessageItem.component.tsx","../src/components/Conversation/CommentThread.component.tsx"],"names":["useRef","useCallback","Fragment","Paperclip","jsx","jsxs"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACzBA,8BAA4C;AAC5C,2CAA0C;AD2B1C;AACA;AE7BA;AACA;AF+BA;AACA;AGjCA;AAWO,IAAM,iBAAA,EAAmB,CAC9B,QAAA,EACA,OAAA,EAAA,GACgB;AAChB,EAAA,MAAM,KAAA,EAAO,2BAAA,IAA+B,CAAA;AAC5C,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,EAAA,EAAI,6BAAA,CAAsB,EAAA,mBAAM,IAAI,GAAA,CAAI,CAAC,CAAA;AAE/D,EAAA,8BAAA,CAAU,EAAA,GAAM;AAEd,IAAA,GAAA,CAAI,IAAA,CAAK,QAAA,IAAY,IAAA,EAAM;AACzB,MAAA,IAAA,CAAK,QAAA,EAAU,IAAI,GAAA,CAAI,QAAA,CAAS,GAAA,CAAI,CAAC,OAAA,EAAA,GAAY,OAAA,CAAQ,EAAE,CAAC,CAAA;AAC5D,MAAA,MAAA;AAAA,IACF;AAEA,IAAA,GAAA,CAAI,CAAC,OAAA,EAAS;AACZ,MAAA,IAAA,CAAA,MAAW,QAAA,GAAW,QAAA,EAAU,IA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AAA;AACqB,IAAA;AAEL,MAAA;AAER,MAAA;AACG,QAAA;AAAM,QAAA;AAAgB,QAAA;AACzB,MAAA;AAEJ,IAAA;AAGoB,IAAA;AAEV,IAAA;AAGT,IAAA;AACE,MAAA;AAAA,MAAA;AACO,QAAA;AACA,QAAA;AACO,QAAA;AACR,QAAA;AAAA,MAAA;AACP,IAAA;AAGe,IAAA;AAIXD,sBAAAA;AAIc,MAAA;AAEgB,QAAA;AAET,UAAA;AACE,UAAA;AACN,UAAA;AACV,QAAA;AAEL,MAAA;AAIC,MAAA;AAGI,QAAA;AAAA,QAAA;AACW,UAAA;AACA,UAAA;AACA,UAAA;AACE,UAAA;AACA,UAAA;AACA,UAAA;AACZ,UAAA;AACA,UAAA;AACA,UAAA;AACS,UAAA;AAAA,QAAA;AAEb,MAAA;AAGP,IAAA;AAKH,IAAA;AAGMA,sBAAAA;AAAuC,MAAA;AAIzC,IAAA;AAOgB,IAAA;AAET,IAAA;AAGf,EAAA;AAEJ;AAEc;ANmqBW;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/eidos-ui/eidos-ui/dist/chunk-ADB7QRX5.cjs","sourcesContent":[null,"import React, { useCallback, useMemo } from 'react';\nimport { ArrowDown, MessagesSquare } from 'lucide-react';\nimport { Button } from '../Button';\nimport { EmptyState } from '../EmptyState';\nimport { Skeleton } from '../Skeleton';\nimport { Spinner } from '../Spinner';\nimport { MessageComposer } from './MessageComposer.component';\nimport { MessageItem } from './MessageItem.component';\nimport type { ChatProps, ConversationMessage } from './Conversation.types';\nimport {\n useLoadMoreOnScrollTop,\n useNewMessageIds,\n useScrollAnchor,\n useStickToBottom,\n} from './Conversation.hooks';\nimport { classNames, continuesRun, formatDateSeparator, isSameDay } from './Conversation.utils';\n\nconst ChatSkeleton: React.FC = () => (\n <div className=\"eidos-chat-skeleton\" aria-hidden=\"true\">\n {[0, 1, 2, 3].map((row) => (\n <div\n key={row}\n className={classNames(\n 'eidos-chat-skeleton-row',\n row % 2 === 1 && 'eidos-chat-skeleton-row--own',\n )}\n >\n <Skeleton variant=\"circular\" width={28} height={28} />\n <Skeleton variant=\"rounded\" height={48} />\n </div>\n ))}\n </div>\n);\n\n/**\n * A bottom-anchored message thread with a composer.\n *\n * Controlled and transport-agnostic: it renders the `messages` it is given and\n * reports intent through `onSend` / `onLoadMore`. It never fetches, so the\n * same array can be persisted and replayed verbatim.\n */\nexport const Chat: React.FC<ChatProps> = ({\n messages,\n currentUserId,\n onSend,\n onRetry,\n readOnly = false,\n readOnlyMessage,\n renderBody,\n messageActions,\n renderMessageFooter,\n loading = false,\n emptyContent,\n hasMore = false,\n loadingMore = false,\n onLoadMore,\n groupConsecutive = true,\n groupWindowMinutes = 5,\n showDateSeparators = true,\n formatTimestamp,\n animateNewMessages = true,\n allowAttachments = false,\n attachmentAccept,\n typing,\n unreadFromId,\n placeholder = 'Write a message...',\n sendOnEnter = true,\n ariaLabel = 'Conversation',\n className = '',\n}) => {\n const { scrollRef, contentRef, atBottom, scrollToBottom, handleScroll } =\n useStickToBottom(messages);\n const newIds = useNewMessageIds(messages, animateNewMessages);\n useScrollAnchor(scrollRef, messages);\n\n const loadMoreOnScroll = useLoadMoreOnScrollTop(scrollRef, { hasMore, loadingMore, onLoadMore });\n\n const onScroll = useCallback(() => {\n handleScroll();\n loadMoreOnScroll();\n }, [handleScroll, loadMoreOnScroll]);\n\n const byId = useMemo(() => new Map(messages.map((message) => [message.id, message])), [messages]);\n\n // An id that isn't in the current page must not draw a divider above\n // nothing - it would float at the top of whatever happens to be loaded.\n const unreadIndex = useMemo(() => {\n if (!unreadFromId) return -1;\n return messages.findIndex((message) => message.id === unreadFromId);\n }, [messages, unreadFromId]);\n\n const showComposer = !readOnly && Boolean(onSend);\n const isEmpty = !loading && messages.length === 0;\n\n const renderMessage = (message: ConversationMessage, index: number) => {\n const previous = messages[index - 1];\n const actions = readOnly ? undefined : messageActions?.(message);\n const quoted = message.parentId ? byId.get(message.parentId) : undefined;\n\n const nodes: React.ReactNode[] = [];\n\n if (showDateSeparators && (!previous || !isSameDay(previous.sentAt, message.sentAt))) {\n nodes.push(\n <li key={`date-${message.id}`} className=\"eidos-conversation-separator\">\n <span>{formatDateSeparator(message.sentAt)}</span>\n </li>,\n );\n }\n\n if (index === unreadIndex) {\n nodes.push(\n <li\n key={`unread-${message.id}`}\n className=\"eidos-conversation-separator eidos-conversation-separator--unread\"\n >\n <span>Unread messages</span>\n </li>,\n );\n }\n\n // A separator breaks a run: the message under it needs its own header.\n const grouped =\n groupConsecutive &&\n index !== unreadIndex &&\n nodes.length === 0 &&\n continuesRun(previous, message, groupWindowMinutes);\n\n nodes.push(\n <MessageItem\n key={message.id}\n message={message}\n layout=\"chat\"\n isOwn={Boolean(currentUserId) && message.author.id === currentUserId}\n grouped={grouped}\n isNew={newIds.has(message.id)}\n actions={actions}\n footer={renderMessageFooter?.(message)}\n body={renderBody?.(message)}\n onRetry={!readOnly && onRetry ? () => onRetry(message) : undefined}\n quoted={quoted}\n formatTimestamp={formatTimestamp}\n />,\n );\n\n return nodes;\n };\n\n return (\n <div className={classNames('eidos-chat', className)}>\n <div\n ref={scrollRef}\n className=\"eidos-chat-scroll\"\n onScroll={onScroll}\n role=\"log\"\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n aria-busy={loading}\n aria-label={ariaLabel}\n tabIndex={0}\n >\n {/* One wrapper whose height is the content height, so\n `useStickToBottom` can observe growth that doesn't change the\n message count - a streamed reply, the typing indicator. */}\n <div ref={contentRef} className=\"eidos-chat-scroll-content\">\n {hasMore && (\n <div className=\"eidos-chat-load-more\">\n {loadingMore ? (\n <span className=\"eidos-chat-loading-more\">\n <Spinner size=\"sm\" color=\"secondary\" />\n Loading earlier messages…\n </span>\n ) : (\n <Button variant=\"text\" color=\"secondary\" size=\"sm\" onClick={onLoadMore}>\n Load earlier messages\n </Button>\n )}\n </div>\n )}\n\n {loading && <ChatSkeleton />}\n\n {isEmpty &&\n (emptyContent ?? (\n <EmptyState\n icon={<MessagesSquare />}\n title=\"No messages yet\"\n description={\n showComposer ? 'Send the first message to start the conversation.' : undefined\n }\n size=\"sm\"\n />\n ))}\n\n {!loading && messages.length > 0 && (\n <ol className=\"eidos-conversation-list\">{messages.map(renderMessage)}</ol>\n )}\n\n {typing && typing.length > 0 && (\n <div className=\"eidos-chat-typing\" aria-live=\"polite\">\n <span className=\"eidos-chat-typing-dots\" aria-hidden=\"true\">\n <i />\n <i />\n <i />\n </span>\n {typing.length === 1\n ? `${typing[0].name} is typing…`\n : `${typing.length} people are typing…`}\n </div>\n )}\n </div>\n </div>\n\n {!atBottom && messages.length > 0 && (\n <div className=\"eidos-chat-jump\">\n <Button\n size=\"sm\"\n variant=\"filled\"\n color=\"secondary\"\n preIcon={ArrowDown}\n onClick={() => scrollToBottom('smooth')}\n >\n Latest\n </Button>\n </div>\n )}\n\n {showComposer && (\n <div className=\"eidos-chat-composer\">\n <MessageComposer\n onSubmit={onSend as NonNullable<typeof onSend>}\n placeholder={placeholder}\n sendOnEnter={sendOnEnter}\n allowAttachments={allowAttachments}\n attachmentAccept={attachmentAccept}\n />\n </div>\n )}\n\n {readOnly && readOnlyMessage && (\n <p className=\"eidos-conversation-readonly\">{readOnlyMessage}</p>\n )}\n </div>\n );\n};\n\nChat.displayName = 'Chat';\n","import React, { useCallback, useId, useRef, useState } from 'react';\nimport { Paperclip, Send, X } from 'lucide-react';\nimport { Avatar } from '../Avatar';\nimport { Button } from '../Button';\nimport { Chip } from '../Chip';\nimport type { MessageComposerProps } from './Conversation.types';\nimport { useAutoGrow } from './Conversation.hooks';\nimport { classNames, formatFileSize } from './Conversation.utils';\n\n/**\n * The authoring half of a conversation - a growing text field, optional\n * attachments, and a submit control.\n *\n * Exported on its own so a consumer building a bespoke list can still reuse\n * the input, and used internally by both `Chat` and `CommentThread`.\n */\nexport const MessageComposer: React.FC<MessageComposerProps> = ({\n value,\n onChange,\n onSubmit,\n onCancel,\n placeholder = 'Write a message...',\n submitLabel = 'Send',\n sendOnEnter = false,\n parentId,\n replyingTo,\n allowAttachments = false,\n attachmentAccept,\n author,\n disabled = false,\n requireBody = true,\n autoFocus = false,\n maxLength,\n className = '',\n}) => {\n const [internalBody, setInternalBody] = useState('');\n const [attachments, setAttachments] = useState<File[]>([]);\n const [pending, setPending] = useState(false);\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const fileInputId = useId();\n\n const isControlled = value !== undefined;\n const body = isControlled ? value : internalBody;\n\n useAutoGrow(textareaRef, body);\n\n const setBody = useCallback(\n (next: string) => {\n if (!isControlled) setInternalBody(next);\n onChange?.(next);\n },\n [isControlled, onChange],\n );\n\n const canSubmit = !disabled && !pending && (!requireBody || body.trim().length > 0);\n\n const submit = useCallback(async () => {\n if (!canSubmit) return;\n\n const draft = { body: body.trim(), attachments, parentId };\n const result = onSubmit(draft);\n\n // A synchronous handler clears immediately; an async one keeps the draft\n // until it resolves, so a rejected send never loses what was typed.\n if (!(result instanceof Promise)) {\n setBody('');\n setAttachments([]);\n return;\n }\n\n setPending(true);\n try {\n await result;\n setBody('');\n setAttachments([]);\n } catch {\n // Intentionally swallowed: the draft stays put and the consumer owns\n // error reporting (a Snackbar, an Alert, ...). Rethrowing here would\n // surface as an unhandled rejection from a keystroke.\n } finally {\n setPending(false);\n }\n }, [canSubmit, body, attachments, parentId, onSubmit, setBody]);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (!sendOnEnter) return;\n // Shift+Enter always inserts a newline; the modifier check also leaves\n // IME composition (which fires Enter to commit) alone.\n if (event.key !== 'Enter' || event.shiftKey || event.nativeEvent.isComposing) return;\n event.preventDefault();\n void submit();\n };\n\n const addFiles = (list: FileList | null) => {\n if (!list?.length) return;\n setAttachments((current) => [...current, ...Array.from(list)]);\n // Reset so selecting the same file twice in a row still fires `change`.\n if (fileInputRef.current) fileInputRef.current.value = '';\n };\n\n const removeAttachment = (index: number) =>\n setAttachments((current) => current.filter((_, i) => i !== index));\n\n return (\n <form\n className={classNames('eidos-message-composer', className)}\n onSubmit={(event) => {\n event.preventDefault();\n void submit();\n }}\n >\n {replyingTo && (\n <div className=\"eidos-composer-reply-hint\">\n <span>\n Replying to <strong>{replyingTo}</strong>\n </span>\n {onCancel && (\n <Button\n variant=\"text\"\n color=\"secondary\"\n size=\"sm\"\n icon={X}\n onClick={onCancel}\n tooltip=\"Cancel reply\"\n aria-label=\"Cancel reply\"\n />\n )}\n </div>\n )}\n\n <div className=\"eidos-composer-row\">\n {author && (\n <div className=\"eidos-composer-avatar\">\n <Avatar\n src={author.avatarSrc}\n name={author.name}\n size=\"sm\"\n color={author.avatarColor ?? 'gray'}\n />\n </div>\n )}\n\n <div className=\"eidos-composer-field\">\n <textarea\n ref={textareaRef}\n className=\"eidos-composer-input\"\n value={body}\n onChange={(event) => setBody(event.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled || pending}\n rows={1}\n maxLength={maxLength}\n // Opt-in and off by default. Only the reply composer sets it, where\n // the field appears in direct response to the user pressing Reply -\n // moving focus there is the expected outcome, not a hijack.\n autoFocus={autoFocus}\n aria-label={placeholder}\n />\n\n {attachments.length > 0 && (\n <ul className=\"eidos-composer-attachments\">\n {attachments.map((file, index) => (\n <li key={`${file.name}-${file.size}-${index}`}>\n <Chip\n size=\"sm\"\n variant=\"outlined\"\n color=\"secondary\"\n preIcon={Paperclip}\n onRemove={() => removeAttachment(index)}\n >\n {file.name}\n {file.size > 0 && ` (${formatFileSize(file.size)})`}\n </Chip>\n </li>\n ))}\n </ul>\n )}\n </div>\n </div>\n\n <div className=\"eidos-composer-actions\">\n <div className=\"eidos-composer-actions-start\">\n {allowAttachments && (\n <>\n <input\n ref={fileInputRef}\n id={fileInputId}\n type=\"file\"\n multiple\n accept={attachmentAccept}\n // Hidden from both the tab order and the accessibility\n // tree. It is a proxy: the visible button above opens the\n // file dialog via `.click()`, so this input is an\n // implementation detail, not a control.\n //\n // `visually-hidden` keeps an element *focusable* - that is\n // the point of it, for skip links and screen-reader-only\n // text - so a keyboard user landed on an invisible control\n // and met the same \"Attach files\" action twice. `FileUpload`\n // already gets this right with `display: none` +\n // `tabIndex={-1}`; these two had drifted from it.\n //\n // `aria-hidden` is safe here only *because* of the\n // `tabIndex={-1}` beside it - hiding a focusable element is\n // its own violation.\n className=\"eidos-composer-file-input\"\n tabIndex={-1}\n aria-hidden=\"true\"\n onChange={(event) => addFiles(event.target.files)}\n disabled={disabled || pending}\n />\n <Button\n variant=\"text\"\n color=\"secondary\"\n size=\"sm\"\n icon={Paperclip}\n tooltip=\"Attach files\"\n aria-label=\"Attach files\"\n disabled={disabled || pending}\n onClick={() => fileInputRef.current?.click()}\n />\n </>\n )}\n {sendOnEnter && (\n <span className=\"eidos-composer-hint\">\n <kbd>Enter</kbd> to send · <kbd>Shift</kbd>+<kbd>Enter</kbd> for a new line\n </span>\n )}\n </div>\n\n <div className=\"eidos-composer-actions-end\">\n {onCancel && !replyingTo && (\n <Button\n variant=\"text\"\n color=\"secondary\"\n size=\"sm\"\n onClick={onCancel}\n disabled={pending}\n >\n Cancel\n </Button>\n )}\n <Button\n type=\"submit\"\n size=\"sm\"\n color=\"primary\"\n preIcon={Send}\n loading={pending}\n disabled={!canSubmit}\n >\n {submitLabel}\n </Button>\n </div>\n </div>\n </form>\n );\n};\n\nMessageComposer.displayName = 'MessageComposer';\n","import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport type { ConversationMessage } from './Conversation.types';\n\n/**\n * Ids that arrived *after* the first render.\n *\n * Seeded from the first commit so an initial page of history is never\n * animated - otherwise opening a thread fades forty messages in at once,\n * which reads as a glitch rather than as feedback. Only genuinely new ids get\n * the entrance class, and each one only once.\n */\nexport const useNewMessageIds = (\n messages: ConversationMessage[],\n enabled: boolean,\n): Set<string> => {\n const seen = useRef<Set<string> | null>(null);\n const [fresh, setFresh] = useState<Set<string>>(() => new Set());\n\n useEffect(() => {\n // First commit: everything already on screen counts as pre-existing.\n if (seen.current === null) {\n seen.current = new Set(messages.map((message) => message.id));\n return;\n }\n\n if (!enabled) {\n for (const message of messages) seen.current.add(message.id);\n return;\n }\n\n const added = messages.filter((message) => !seen.current?.has(message.id));\n if (!added.length) return;\n\n for (const message of added) seen.current.add(message.id);\n setFresh(new Set(added.map((message) => message.id)));\n }, [messages, enabled]);\n\n return fresh;\n};\n\ninterface StickToBottom {\n scrollRef: React.RefObject<HTMLDivElement | null>;\n /**\n * The single element wrapping everything inside the scroll region. Its\n * height *is* the content height, so observing it catches every way the\n * content can grow.\n */\n contentRef: React.RefObject<HTMLDivElement | null>;\n /** The viewport is at (or near) the newest message. */\n atBottom: boolean;\n scrollToBottom: (behavior?: ScrollBehavior) => void;\n handleScroll: () => void;\n}\n\n/** Distance from the bottom still counted as \"reading the newest message\". */\nconst BOTTOM_THRESHOLD_PX = 48;\n\n/**\n * Keeps a bottom-anchored list pinned to the newest message - but only while\n * the reader is already there.\n *\n * Scrolling someone back down while they are reading scrollback is the single\n * most common defect in chat UIs, so arrival of a new message only forces a\n * scroll when `atBottom` was already true. Otherwise the caller surfaces a\n * jump-to-latest affordance and leaves the viewport alone.\n */\nexport const useStickToBottom = (messages: ConversationMessage[]): StickToBottom => {\n const scrollRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const [atBottom, setAtBottom] = useState(true);\n // Read during a layout effect, so it must not be state - it has to be\n // correct for the commit that is happening right now, not the next render.\n const atBottomRef = useRef(true);\n const lastCount = useRef(messages.length);\n const lastScrollTop = useRef(0);\n\n const scrollToBottom = useCallback((behavior: ScrollBehavior = 'smooth') => {\n const node = scrollRef.current;\n if (!node) return;\n node.scrollTo({ top: node.scrollHeight, behavior });\n }, []);\n\n // Stickiness is released only by the *reader* moving up, never by distance\n // alone.\n //\n // Measuring distance alone is wrong the moment content can grow while a\n // smooth scroll is in flight: the scroll events fired mid-animation report\n // the gap to a bottom that has since moved further away, so the reader - who\n // never touched anything - is declared \"not at the bottom\" and the thread\n // stops following a streamed reply partway through. A programmatic scroll\n // to the bottom only ever *increases* `scrollTop`, and content growth does\n // not change it at all, so a decrease is a reliable signal of intent: wheel,\n // keyboard, scrollbar drag and touch all produce one.\n const handleScroll = useCallback(() => {\n const node = scrollRef.current;\n if (!node) return;\n const distance = node.scrollHeight - node.scrollTop - node.clientHeight;\n const movedUp = node.scrollTop < lastScrollTop.current;\n lastScrollTop.current = node.scrollTop;\n\n let next = atBottomRef.current;\n if (distance <= BOTTOM_THRESHOLD_PX) next = true;\n else if (movedUp) next = false;\n\n atBottomRef.current = next;\n setAtBottom((current) => (current === next ? current : next));\n }, []);\n\n // Jump (not animate) to the bottom on first paint so a thread opens on its\n // newest message instead of visibly scrolling there.\n useLayoutEffect(() => {\n scrollToBottom('auto');\n // eslint-disable-next-line react-hooks/exhaustive-deps -- mount only\n }, []);\n\n useLayoutEffect(() => {\n if (messages.length > lastCount.current && atBottomRef.current) {\n scrollToBottom('smooth');\n }\n lastCount.current = messages.length;\n }, [messages.length, scrollToBottom]);\n\n // The effect above only reacts to the *number* of messages. A reply that is\n // streamed into an existing message - or a typing indicator appearing, or\n // an image loading - grows the content without changing that number, and\n // used to push the newest text below the fold while the reader was sitting\n // at the bottom waiting for it.\n //\n // Observing the content wrapper covers every one of those, because its\n // height is the content height. The scroll container itself cannot be\n // observed for this: its own box never changes size, only its\n // `scrollHeight` does.\n //\n // `'auto'`, not `'smooth'`: a stream grows the content once per token, and\n // a smooth scroll restarted that often never catches up with the text.\n // `atBottomRef` still holds the reader's position from *before* the growth,\n // which is exactly the question - \"were they following along?\".\n //\n // Growth that coincides with a new message is left to the smooth scroll the\n // layout effect above already started; jumping here as well would cancel\n // that animation on every single arrival.\n useEffect(() => {\n const content = contentRef.current;\n if (!content || typeof ResizeObserver === 'undefined') return;\n\n let lastHeight = content.getBoundingClientRect().height;\n let observedCount = lastCount.current;\n const observer = new ResizeObserver(() => {\n const height = content.getBoundingClientRect().height;\n const countChanged = observedCount !== lastCount.current;\n observedCount = lastCount.current;\n if (height > lastHeight && !countChanged && atBottomRef.current) scrollToBottom('auto');\n lastHeight = height;\n });\n observer.observe(content);\n return () => observer.disconnect();\n }, [scrollToBottom]);\n\n return { scrollRef, contentRef, atBottom, scrollToBottom, handleScroll };\n};\n\n/**\n * Preserves the reader's position when older messages are prepended.\n *\n * Without this, inserting a page above the viewport pushes the content the\n * user was reading down by the height of everything added, which reads as the\n * list jumping to a random place. Capturing `scrollHeight` before the DOM\n * mutation and restoring the delta in a *layout* effect corrects it before the\n * browser paints, so there is no visible shift.\n */\nexport const useScrollAnchor = (\n scrollRef: React.RefObject<HTMLDivElement | null>,\n messages: ConversationMessage[],\n): void => {\n const previous = useRef({ height: 0, firstId: '', count: 0 });\n\n useLayoutEffect(() => {\n const node = scrollRef.current;\n if (!node) return;\n\n const firstId = messages[0]?.id ?? '';\n const before = previous.current;\n // A prepend is the only case where the first id changes while the list\n // grows - an append leaves it untouched, and a replacement shrinks it.\n const prepended =\n before.firstId !== '' && before.firstId !== firstId && messages.length > before.count;\n\n if (prepended) {\n node.scrollTop += node.scrollHeight - before.height;\n }\n\n previous.current = { height: node.scrollHeight, firstId, count: messages.length };\n }, [messages, scrollRef]);\n};\n\n/**\n * Fires `onLoadMore` once the reader approaches the top of the history.\n *\n * Latched on the way in and released only after they scroll back out of the\n * trigger zone, so a single pause near the top can't queue a dozen fetches.\n */\nexport const useLoadMoreOnScrollTop = (\n scrollRef: React.RefObject<HTMLDivElement | null>,\n {\n hasMore,\n loadingMore,\n onLoadMore,\n }: {\n hasMore?: boolean;\n loadingMore?: boolean;\n onLoadMore?: () => void;\n },\n thresholdPx = 80,\n): (() => void) => {\n const armed = useRef(true);\n\n return useCallback(() => {\n const node = scrollRef.current;\n if (!node) return;\n\n if (node.scrollTop > thresholdPx) {\n armed.current = true;\n return;\n }\n\n if (!armed.current || !hasMore || loadingMore || !onLoadMore) return;\n armed.current = false;\n onLoadMore();\n }, [scrollRef, hasMore, loadingMore, onLoadMore, thresholdPx]);\n};\n\n/**\n * Grows a textarea to fit its content, up to `maxHeight`.\n *\n * Height is written to `style.height` directly rather than through a React\n * inline style: it is measured from the live DOM after every keystroke, so it\n * cannot be expressed as a class, and routing it through state would add a\n * render per character. Assigning the property imperatively also keeps it out\n * of the server-rendered `style` attribute that CSP's `style-src-attr` gates.\n */\nexport const useAutoGrow = (\n ref: React.RefObject<HTMLTextAreaElement | null>,\n value: string,\n maxHeight = 200,\n): void => {\n useLayoutEffect(() => {\n const node = ref.current;\n if (!node) return;\n\n node.style.height = 'auto';\n const next = Math.min(node.scrollHeight, maxHeight);\n node.style.height = `${next}px`;\n node.style.overflowY = node.scrollHeight > maxHeight ? 'auto' : 'hidden';\n }, [ref, value, maxHeight]);\n};\n","import type { ConversationMessage } from './Conversation.types';\n\n/**\n * Timestamp formatting goes through `Intl` rather than a date library on\n * purpose: `dayjs` is currently bundled only into the `DatePicker` chunk, and\n * pulling it in here would add it to every consumer importing a conversation.\n * `Intl` is built in and already locale-aware.\n */\n\nconst timeFormat = new Intl.DateTimeFormat(undefined, {\n hour: '2-digit',\n minute: '2-digit',\n});\n\nconst dateFormat = new Intl.DateTimeFormat(undefined, {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n});\n\nconst dateFormatSameYear = new Intl.DateTimeFormat(undefined, {\n day: 'numeric',\n month: 'long',\n});\n\n/** Parses an ISO string, returning null rather than an `Invalid Date`. */\nexport const parseDate = (iso: string): Date | null => {\n const date = new Date(iso);\n return Number.isNaN(date.getTime()) ? null : date;\n};\n\nexport const formatMessageTime = (iso: string): string => {\n const date = parseDate(iso);\n return date ? timeFormat.format(date) : iso;\n};\n\nconst startOfDay = (date: Date): number =>\n new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();\n\nexport const isSameDay = (a: string, b: string): boolean => {\n const first = parseDate(a);\n const second = parseDate(b);\n if (!first || !second) return false;\n return startOfDay(first) === startOfDay(second);\n};\n\n/** `Today` / `Yesterday` / a full date, for the divider between days. */\nexport const formatDateSeparator = (iso: string): string => {\n const date = parseDate(iso);\n if (!date) return iso;\n\n const now = new Date();\n const dayDelta = Math.round((startOfDay(now) - startOfDay(date)) / 86_400_000);\n\n if (dayDelta === 0) return 'Today';\n if (dayDelta === 1) return 'Yesterday';\n return date.getFullYear() === now.getFullYear()\n ? dateFormatSameYear.format(date)\n : dateFormat.format(date);\n};\n\nconst FILE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB'];\n\nexport const formatFileSize = (bytes: number): string => {\n if (!Number.isFinite(bytes) || bytes < 0) return '';\n if (bytes < 1024) return `${bytes} B`;\n\n let value = bytes;\n let unit = 0;\n while (value >= 1024 && unit < FILE_UNITS.length - 1) {\n value /= 1024;\n unit += 1;\n }\n // One decimal below 10 (9.4 MB), none above it (24 MB) - the extra digit\n // stops carrying information once the integer part is two digits.\n return `${value < 10 ? value.toFixed(1) : Math.round(value)} ${FILE_UNITS[unit]}`;\n};\n\n/**\n * Whether `message` continues a run started by `previous` - same author, same\n * day, and within the grouping window. A grouped message hides its avatar and\n * author line.\n */\nexport const continuesRun = (\n previous: ConversationMessage | undefined,\n message: ConversationMessage,\n windowMinutes: number,\n): boolean => {\n if (!previous) return false;\n if (previous.author.id !== message.author.id) return false;\n if (!isSameDay(previous.sentAt, message.sentAt)) return false;\n\n const before = parseDate(previous.sentAt);\n const after = parseDate(message.sentAt);\n if (!before || !after) return false;\n\n return Math.abs(after.getTime() - before.getTime()) <= windowMinutes * 60_000;\n};\n\nexport const sortBySentAt = (messages: ConversationMessage[]): ConversationMessage[] =>\n [...messages].sort((a, b) => {\n const first = parseDate(a.sentAt)?.getTime() ?? 0;\n const second = parseDate(b.sentAt)?.getTime() ?? 0;\n return first - second;\n });\n\nexport interface ThreadNode {\n message: ConversationMessage;\n replies: ConversationMessage[];\n}\n\n/**\n * Collapses a flat list into one level of nesting.\n *\n * Deeper chains are flattened onto the nearest **top-level** ancestor rather\n * than being dropped or nested further: indentation past one level is\n * unreadable on a phone, and silently discarding a reply-to-a-reply would lose\n * data the consumer stored. `replyingToName` on the rendered reply is what\n * preserves who was actually answered.\n *\n * A `parentId` pointing at a message that isn't present (paged out, deleted)\n * is treated as top-level, so nothing ever disappears from the list.\n */\nexport const buildThread = (messages: ConversationMessage[]): ThreadNode[] => {\n const byId = new Map(messages.map((message) => [message.id, message]));\n\n /** Walks up to the outermost ancestor, guarding against a parentId cycle. */\n const rootIdOf = (message: ConversationMessage): string => {\n const seen = new Set<string>([message.id]);\n let current = message;\n\n while (current.parentId) {\n const parent = byId.get(current.parentId);\n if (!parent || seen.has(parent.id)) break;\n seen.add(parent.id);\n current = parent;\n }\n\n return current.id;\n };\n\n const nodes = new Map<string, ThreadNode>();\n const roots: ThreadNode[] = [];\n\n for (const message of messages) {\n if (message.parentId && byId.has(message.parentId)) continue;\n const node: ThreadNode = { message, replies: [] };\n nodes.set(message.id, node);\n roots.push(node);\n }\n\n for (const message of messages) {\n if (!message.parentId || !byId.has(message.parentId)) continue;\n nodes.get(rootIdOf(message))?.replies.push(message);\n }\n\n for (const node of nodes.values()) {\n node.replies = sortBySentAt(node.replies);\n }\n\n return roots;\n};\n\n/** Name of the author a reply was addressed to, when it isn't its own parent. */\nexport const replyTargetName = (\n message: ConversationMessage,\n byId: Map<string, ConversationMessage>,\n rootId: string,\n): string | undefined => {\n if (!message.parentId || message.parentId === rootId) return undefined;\n return byId.get(message.parentId)?.author.name;\n};\n\n/** Trims a quoted excerpt so a long parent message can't dominate the reply. */\nexport const excerpt = (body: string, maxLength = 120): string => {\n const flat = body.replace(/\\s+/g, ' ').trim();\n return flat.length > maxLength ? `${flat.slice(0, maxLength - 1)}…` : flat;\n};\n\nexport const classNames = (...values: Array<string | false | null | undefined>): string =>\n values.filter(Boolean).join(' ');\n","import React from 'react';\nimport { AlertCircle, MoreHorizontal, Paperclip, RotateCw } from 'lucide-react';\nimport { Avatar } from '../Avatar';\nimport { Button } from '../Button';\nimport { Menu } from '../Menu';\nimport { Pill } from '../Pill';\nimport { Spinner } from '../Spinner';\nimport type { ConversationMessage, MessageAttachment } from './Conversation.types';\nimport type { MenuItemType } from '../Menu';\nimport { classNames, excerpt, formatFileSize, formatMessageTime } from './Conversation.utils';\n\nexport interface MessageItemProps {\n message: ConversationMessage;\n /** 'chat' right-aligns own messages into bubbles; 'comment' renders a flat card. */\n layout: 'chat' | 'comment';\n isOwn: boolean;\n /** Continues a run from the same author - hides the avatar and author line. */\n grouped: boolean;\n /** Plays the entrance animation. */\n isNew: boolean;\n actions?: MenuItemType[];\n footer?: React.ReactNode;\n body?: React.ReactNode;\n onRetry?: () => void;\n /** Author of the message being answered, for a flattened deep reply. */\n replyingToName?: string;\n /** Quoted parent, rendered above the body in chat layout. */\n quoted?: ConversationMessage;\n /** Reply affordance; omitted entirely when the viewer may not reply. */\n onReply?: () => void;\n formatTimestamp?: (iso: string) => string;\n}\n\nconst AttachmentList: React.FC<{ attachments: MessageAttachment[] }> = ({ attachments }) => (\n <ul className=\"eidos-message-attachments\">\n {attachments.map((attachment) => {\n const label = (\n <>\n <Paperclip aria-hidden=\"true\" />\n <span className=\"eidos-message-attachment-name\">{attachment.name}</span>\n {attachment.size !== undefined && (\n <span className=\"eidos-message-attachment-size\">{formatFileSize(attachment.size)}</span>\n )}\n </>\n );\n\n return (\n <li key={attachment.id} className=\"eidos-message-attachment\">\n {attachment.url ? (\n <a\n href={attachment.url}\n className=\"eidos-message-attachment-link\"\n target=\"_blank\"\n rel=\"noreferrer\"\n download={attachment.name}\n >\n {label}\n </a>\n ) : (\n <span className=\"eidos-message-attachment-link\">{label}</span>\n )}\n </li>\n );\n })}\n </ul>\n);\n\nexport const MessageItem: React.FC<MessageItemProps> = ({\n message,\n layout,\n isOwn,\n grouped,\n isNew,\n actions,\n footer,\n body,\n onRetry,\n replyingToName,\n quoted,\n onReply,\n formatTimestamp,\n}) => {\n const { author, status = 'sent' } = message;\n const timestamp = formatTimestamp\n ? formatTimestamp(message.sentAt)\n : formatMessageTime(message.sentAt);\n // An empty action list must not leave a dead trigger behind - see the\n // permissions note in Conversation.types.ts.\n const hasActions = Boolean(actions && actions.length > 0);\n\n // One placement per layout, rather than one per message.\n //\n // `chat` puts the time at the foot of the bubble, where a grouped message\n // already had it; it used to appear in the header for the first message of a\n // group and inside the bubble for the rest, so a single thread showed the\n // same fact in two places. `comment` keeps it in the header, where the row is\n // full width and has space for it.\n const timeInBubble = layout === 'chat';\n\n return (\n <li\n className={classNames(\n 'eidos-message',\n `eidos-message--${layout}`,\n isOwn && 'eidos-message--own',\n grouped && 'eidos-message--grouped',\n status !== 'sent' && `eidos-message--${status}`,\n isNew && 'eidos-message--enter',\n )}\n data-message-id={message.id}\n >\n <div className=\"eidos-message-avatar\">\n {!grouped && (\n <Avatar\n src={author.avatarSrc}\n name={author.name}\n size=\"sm\"\n color={author.avatarColor ?? 'gray'}\n />\n )}\n </div>\n\n <div className=\"eidos-message-main\">\n {!grouped && (\n <div className=\"eidos-message-header\">\n <span className=\"eidos-message-author\">{author.name}</span>\n {author.role && (\n <Pill size=\"sm\" variant=\"outlined\" color=\"secondary\">\n {author.role}\n </Pill>\n )}\n {!timeInBubble && (\n <time className=\"eidos-message-time\" dateTime={message.sentAt}>\n {timestamp}\n </time>\n )}\n {message.edited && <span className=\"eidos-message-edited\">edited</span>}\n </div>\n )}\n\n <div className=\"eidos-message-bubble\">\n {quoted && (\n <blockquote className=\"eidos-message-quote\">\n <span className=\"eidos-message-quote-author\">{quoted.author.name}</span>\n <span className=\"eidos-message-quote-body\">{excerpt(quoted.body)}</span>\n </blockquote>\n )}\n\n {replyingToName && (\n <span className=\"eidos-message-reply-target\">Replying to {replyingToName}</span>\n )}\n\n <div className=\"eidos-message-body\">{body ?? message.body}</div>\n\n {message.attachments && message.attachments.length > 0 && (\n <AttachmentList attachments={message.attachments} />\n )}\n\n {(timeInBubble || grouped) && (\n <time\n className=\"eidos-message-time eidos-message-time--inline\"\n dateTime={message.sentAt}\n >\n {timestamp}\n </time>\n )}\n </div>\n\n {status === 'sending' && (\n <span className=\"eidos-message-status\">\n <Spinner size=\"sm\" color=\"secondary\" />\n Sending…\n </span>\n )}\n\n {status === 'failed' && (\n <span className=\"eidos-message-status eidos-message-status--failed\">\n <AlertCircle aria-hidden=\"true\" />\n Not sent\n {onRetry && (\n <Button variant=\"text\" color=\"danger\" size=\"sm\" preIcon={RotateCw} onClick={onRetry}>\n Retry\n </Button>\n )}\n </span>\n )}\n\n {footer && <div className=\"eidos-message-footer\">{footer}</div>}\n\n {onReply && (\n <div className=\"eidos-message-reply\">\n <Button variant=\"text\" color=\"secondary\" size=\"sm\" onClick={onReply}>\n Reply\n </Button>\n </div>\n )}\n </div>\n\n {hasActions && (\n <div className=\"eidos-message-actions\">\n <Menu\n items={actions ?? []}\n trigger={\n <Button\n variant=\"text\"\n color=\"secondary\"\n size=\"sm\"\n icon={MoreHorizontal}\n aria-label={`Actions for ${author.name}'s message`}\n />\n }\n />\n </div>\n )}\n </li>\n );\n};\n\nMessageItem.displayName = 'MessageItem';\n","import React, { useCallback, useMemo, useState } from 'react';\nimport { MessageSquare } from 'lucide-react';\nimport { Button } from '../Button';\nimport { EmptyState } from '../EmptyState';\nimport { Skeleton } from '../Skeleton';\nimport { Spinner } from '../Spinner';\nimport { MessageComposer } from './MessageComposer.component';\nimport { MessageItem } from './MessageItem.component';\nimport type { CommentThreadProps, ConversationMessage, MessageDraft } from './Conversation.types';\nimport { useNewMessageIds } from './Conversation.hooks';\nimport {\n buildThread,\n classNames,\n continuesRun,\n replyTargetName,\n sortBySentAt,\n} from './Conversation.utils';\n\nconst CommentSkeleton: React.FC = () => (\n <div className=\"eidos-comment-thread-skeleton\" aria-hidden=\"true\">\n {[0, 1, 2].map((row) => (\n <div key={row} className=\"eidos-comment-thread-skeleton-row\">\n <Skeleton variant=\"circular\" width={28} height={28} />\n <Skeleton variant=\"text\" lines={2} />\n </div>\n ))}\n </div>\n);\n\n/**\n * A comment section: document flow, no internal scroll container, one level of\n * nesting.\n *\n * Shares its data model and message rendering with `Chat`, so history captured\n * in one can be displayed in the other. Unlike `Chat` it has no scroll region\n * of its own - it grows with the page and pages *downward* via `onLoadMore`.\n */\nexport const CommentThread: React.FC<CommentThreadProps> = ({\n messages,\n currentUserId,\n onSend,\n onReply,\n onRetry,\n readOnly = false,\n readOnlyMessage,\n renderBody,\n messageActions,\n renderMessageFooter,\n loading = false,\n emptyContent,\n hasMore = false,\n loadingMore = false,\n onLoadMore,\n groupConsecutive = true,\n groupWindowMinutes = 5,\n formatTimestamp,\n animateNewMessages = true,\n allowAttachments = false,\n attachmentAccept,\n order = 'oldest-first',\n composerPosition = 'bottom',\n placeholder = 'Add a comment...',\n sendOnEnter = false,\n title,\n ariaLabel = 'Comments',\n className = '',\n}) => {\n const [replyingToId, setReplyingToId] = useState<string | null>(null);\n const newIds = useNewMessageIds(messages, animateNewMessages);\n\n const byId = useMemo(() => new Map(messages.map((message) => [message.id, message])), [messages]);\n\n const roots = useMemo(() => {\n const thread = buildThread(messages);\n const sorted = sortBySentAt(thread.map((node) => node.message));\n const ordered = order === 'newest-first' ? [...sorted].reverse() : sorted;\n const nodeById = new Map(thread.map((node) => [node.message.id, node]));\n // Replies always read oldest-first, even when roots are reversed - a\n // conversation under a single comment is chronological by nature.\n return ordered.map((message) => nodeById.get(message.id)!);\n }, [messages, order]);\n\n const canReply = !readOnly && Boolean(onReply);\n const showComposer = !readOnly && Boolean(onSend);\n const isEmpty = !loading && messages.length === 0;\n const total = messages.length;\n\n const handleReply = useCallback(\n async (draft: MessageDraft) => {\n await onReply?.(draft);\n setReplyingToId(null);\n },\n [onReply],\n );\n\n const renderComment = (\n message: ConversationMessage,\n options: { rootId: string; previous?: ConversationMessage; isReply: boolean },\n ) => {\n const actions = readOnly ? undefined : messageActions?.(message);\n\n return (\n <MessageItem\n key={message.id}\n message={message}\n layout=\"comment\"\n isOwn={Boolean(currentUserId) && message.author.id === currentUserId}\n grouped={groupConsecutive && continuesRun(options.previous, message, groupWindowMinutes)}\n isNew={newIds.has(message.id)}\n actions={actions}\n footer={renderMessageFooter?.(message)}\n body={renderBody?.(message)}\n onRetry={!readOnly && onRetry ? () => onRetry(message) : undefined}\n replyingToName={\n options.isReply ? replyTargetName(message, byId, options.rootId) : undefined\n }\n onReply={canReply ? () => setReplyingToId(message.id) : undefined}\n formatTimestamp={formatTimestamp}\n />\n );\n };\n\n const composer = showComposer && (\n <MessageComposer\n onSubmit={onSend as NonNullable<typeof onSend>}\n placeholder={placeholder}\n submitLabel=\"Comment\"\n sendOnEnter={sendOnEnter}\n allowAttachments={allowAttachments}\n attachmentAccept={attachmentAccept}\n className=\"eidos-comment-thread-composer\"\n />\n );\n\n return (\n <section className={classNames('eidos-comment-thread', className)} aria-label={ariaLabel}>\n {(title || total > 0) && (\n <header className=\"eidos-comment-thread-header\">\n {title && <h3 className=\"eidos-comment-thread-title\">{title}</h3>}\n {total > 0 && (\n <span className=\"eidos-comment-thread-count\">\n {total} {total === 1 ? 'comment' : 'comments'}\n </span>\n )}\n </header>\n )}\n\n {composerPosition === 'top' && composer}\n\n {loading && <CommentSkeleton />}\n\n {isEmpty &&\n (emptyContent ?? (\n <EmptyState\n icon={<MessageSquare />}\n title=\"No comments yet\"\n description={showComposer ? 'Start the discussion by leaving a comment.' : undefined}\n size=\"sm\"\n />\n ))}\n\n {!loading && roots.length > 0 && (\n <ol className=\"eidos-conversation-list eidos-comment-thread-list\" aria-busy={loadingMore}>\n {roots.map((node) => (\n <li key={node.message.id} className=\"eidos-comment-thread-node\">\n <ol className=\"eidos-conversation-list\">\n {renderComment(node.message, { rootId: node.message.id, isReply: false })}\n </ol>\n\n {node.replies.length > 0 && (\n <ol className=\"eidos-conversation-list eidos-comment-thread-replies\">\n {node.replies.map((reply, index) =>\n renderComment(reply, {\n rootId: node.message.id,\n previous: node.replies[index - 1],\n isReply: true,\n }),\n )}\n </ol>\n )}\n\n {replyingToId &&\n (replyingToId === node.message.id ||\n node.replies.some((reply) => reply.id === replyingToId)) && (\n <div className=\"eidos-comment-thread-reply-composer\">\n <MessageComposer\n onSubmit={handleReply}\n onCancel={() => setReplyingToId(null)}\n parentId={replyingToId}\n replyingTo={byId.get(replyingToId)?.author.name}\n placeholder=\"Write a reply...\"\n submitLabel=\"Reply\"\n sendOnEnter={sendOnEnter}\n allowAttachments={allowAttachments}\n attachmentAccept={attachmentAccept}\n autoFocus\n />\n </div>\n )}\n </li>\n ))}\n </ol>\n )}\n\n {hasMore && (\n <div className=\"eidos-comment-thread-load-more\">\n {loadingMore ? (\n <span className=\"eidos-comment-thread-loading-more\">\n <Spinner size=\"sm\" color=\"secondary\" />\n Loading more comments…\n </span>\n ) : (\n <Button variant=\"outlined\" color=\"secondary\" size=\"sm\" onClick={onLoadMore}>\n Load more comments\n </Button>\n )}\n </div>\n )}\n\n {composerPosition === 'bottom' && composer}\n\n {readOnly && readOnlyMessage && (\n <p className=\"eidos-conversation-readonly\">{readOnlyMessage}</p>\n )}\n </section>\n );\n};\n\nCommentThread.displayName = 'CommentThread';\n"]}
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkXPG56DLQcjs = require('./chunk-XPG56DLQ.cjs');
3
+ var _chunkNSA7ASZ7cjs = require('./chunk-NSA7ASZ7.cjs');
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunkENMDOQQOcjs = require('./chunk-ENMDOQQO.cjs');
8
+ var _chunkR5WI5IGRcjs = require('./chunk-R5WI5IGR.cjs');
9
9
 
10
10
  // src/components/Modal/Modal.component.tsx
11
11
  var _react = require('react');
@@ -27,7 +27,7 @@ var Modal = ({
27
27
  const titleId = _react.useId.call(void 0, );
28
28
  const bodyId = _react.useId.call(void 0, );
29
29
  const dialogRef = _react.useRef.call(void 0, null);
30
- const isClient = _chunkENMDOQQOcjs.useIsClient.call(void 0, );
30
+ const isClient = _chunkR5WI5IGRcjs.useIsClient.call(void 0, );
31
31
  const TRANSITION_MS = 200;
32
32
  const [isMounted, setIsMounted] = _react.useState.call(void 0, isOpen);
33
33
  const [isVisible, setIsVisible] = _react.useState.call(void 0, isOpen);
@@ -76,7 +76,7 @@ var Modal = ({
76
76
  document.body.style.overflow = "";
77
77
  };
78
78
  }, [isOpen, handleEscapeKey]);
79
- _chunkENMDOQQOcjs.useDialogFocus.call(void 0, isClient && isOpen && isVisible, dialogRef);
79
+ _chunkR5WI5IGRcjs.useDialogFocus.call(void 0, isClient && isOpen && isVisible, dialogRef);
80
80
  if (!isClient || !isMounted) return null;
81
81
  const modalContent = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `eidos-modal ${isVisible ? "eidos-modal--is-open" : ""} ${className}`, children: [
82
82
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "eidos-modal-backdrop", onClick: handleBackdropClick, "aria-hidden": "true" }),
@@ -91,13 +91,13 @@ var Modal = ({
91
91
  className: `eidos-modal-content eidos-modal-content--${size}`,
92
92
  children: [
93
93
  title && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `eidos-modal-header ${type ? `eidos-modal-header--${type}` : ""}`, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "h4", { id: titleId, children: [
94
- icon && _chunkENMDOQQOcjs.renderIcon.call(void 0, icon, "eidos-modal-icon"),
94
+ icon && _chunkR5WI5IGRcjs.renderIcon.call(void 0, icon, "eidos-modal-icon"),
95
95
  " ",
96
96
  title
97
97
  ] }) }),
98
98
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { id: bodyId, className: "eidos-modal-body", children }),
99
99
  actions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `eidos-modal-footer`, children: actions.map((action) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
100
- _chunkXPG56DLQcjs.Button,
100
+ _chunkNSA7ASZ7cjs.Button,
101
101
  {
102
102
  variant: action.variant || "outlined",
103
103
  size: action.size || "md",
@@ -120,4 +120,4 @@ Modal.displayName = "Modal";
120
120
 
121
121
 
122
122
  exports.Modal = Modal;
123
- //# sourceMappingURL=chunk-6CW5QSYV.cjs.map
123
+ //# sourceMappingURL=chunk-AFGC62AL.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/eidos-ui/eidos-ui/dist/chunk-6CW5QSYV.cjs","../src/components/Modal/Modal.component.tsx"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACTA,8BAAuE;AACvE,qCAA6B;AAyHvB,+CAAA;AApHC,IAAM,MAAA,EAA8B,CAAC;AAAA,EAC1C,MAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA,EAAU,CAAC,CAAA;AAAA,EACX,qBAAA,EAAuB,IAAA;AAAA,EACvB,cAAA,EAAgB,IAAA;AAAA,EAChB,KAAA,EAAO,IAAA;AAAA,EACP,UAAA,EAAY;AACd,CAAA,EAAA,GAAM;AACJ,EAAA,MAAM,QAAA,EAAU,0BAAA,CAAM;AACtB,EAAA,MAAM,OAAA,EAAS,0BAAA,CAAM;AACrB,EAAA,MAAM,UAAA,EAAY,2BAAA,IAA2B,CAAA;AAC7C,EAAA,MAAM,SAAA,EAAW,2CAAA,CAAY;AAW7B,EAAA,MAAM,cAAA,EAAgB,GAAA;AACtB,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,EAAA,EAAI,6BAAA,MAAe,CAAA;AACjD,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,EAAA,EAAI,6BAAA,MAAe,CAAA;AAEjD,EAAA,8BAAA,CAAU,EAAA,GAAM;AACd,IAAA,IAAI,KAAA,EAAO,CAAA;AACX,IAAA,IAAI,KAAA,EAAO,CAAA;AACX,IAAA,IAAI,OAAA;AAEJ,IAAA,GAAA,CAAI,MAAA,EAAQ;AACV,MAAA,YAAA,CAAa,IAAI,CAAA;AAKjB,MAAA,KA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CAAA;AAEpD,MAAA,QAAA,CAAS,IAAA,CAAK,KAAA,CAAM,SAAA,EAAW,QAAA;AAAA,IACjC;AAEA,IAAA,OAAO,CAAA,EAAA,GAAM;AACX,MAAA,QAAA,CAAS,mBAAA,CAAoB,SAAA,EAAW,eAAe,CAAA;AACvD,MAAA,QAAA,CAAS,IAAA,CAAK,KAAA,CAAM,SAAA,EAAW,EAAA;AAAA,IACjC,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,MAAA,EAAQ,eAAe,CAAC,CAAA;AAiB5B,EAAA,8CAAA,SAAe,GAAY,OAAA,GAAU,SAAA,EAAW,SAAS,CAAA;AAMzD,EAAA,GAAA,CAAI,CAAC,SAAA,GAAY,CAAC,SAAA,EAAW,OAAO,IAAA;AAEpC,EAAA,MAAM,aAAA,kBACJ,8BAAA,KAAC,EAAA,EAAI,SAAA,EAAW,CAAA,YAAA,EAAe,UAAA,EAAY,uBAAA,EAAyB,EAAE,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA;AACM,oBAAA;AACvF,oBAAA;AAAC,MAAA;AAAA,MAAA;AACM,QAAA;AACA,QAAA;AACM,QAAA;AACwB,QAAA;AACjB,QAAA;AACyC,QAAA;AAE1D,QAAA;AAEG,UAAA;AAC8C,YAAA;AAAE,YAAA;AAAE,YAAA;AAEpD,UAAA;AAKF,0BAAA;AAKM,UAAA;AAAC,YAAA;AAAA,YAAA;AAE4B,cAAA;AACN,cAAA;AACP,cAAA;AACG,cAAA;AACD,cAAA;AACA,cAAA;AAER,cAAA;AAAA,YAAA;AARI,YAAA;AAWlB,UAAA;AAAA,QAAA;AAAA,MAAA;AAEJ,IAAA;AACF,EAAA;AAG6C,EAAA;AACjD;AAEoB;ADjDgH;AACA;AACA;AACA","file":"/home/runner/work/eidos-ui/eidos-ui/dist/chunk-6CW5QSYV.cjs","sourcesContent":[null,"import React, { useEffect, useCallback, useId, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { Button } from '../Button/Button.component';\nimport type { ModalProps } from './Modal.types';\nimport { renderIcon, useDialogFocus, useIsClient } from '../../utils';\n\nexport const Modal: React.FC<ModalProps> = ({\n isOpen,\n onClose,\n title,\n icon,\n type,\n children,\n actions = [],\n closeOnBackdropClick = true,\n closeOnEscape = true,\n size = 'md',\n className = '',\n}) => {\n const titleId = useId();\n const bodyId = useId();\n const dialogRef = useRef<HTMLDivElement>(null);\n const isClient = useIsClient();\n\n // ── Animation state ────────────────────────────────────────────────────────\n // isMounted: whether the portal DOM node exists at all.\n // isVisible: whether the '--is-open' CSS class is applied (drives the transition).\n //\n // On open: mount first → one rAF → apply --is-open (browser sees the\n // initial faded/scaled-down state before transitioning, so the\n // animation fires instead of just painting straight into \"open\").\n // On close: remove --is-open (CSS transition plays) → after 200 ms unmount.\n // 200 ms matches the CSS `transition: 0.2s` in Modal.scss.\n const TRANSITION_MS = 200;\n const [isMounted, setIsMounted] = useState(isOpen);\n const [isVisible, setIsVisible] = useState(isOpen);\n\n useEffect(() => {\n let raf1 = 0;\n let raf2 = 0;\n let timerId: ReturnType<typeof setTimeout>;\n\n if (isOpen) {\n setIsMounted(true);\n // Double rAF: React 18 automatic batching means setIsMounted(true) may\n // not produce a committed browser paint before the first rAF fires.\n // The second frame guarantees the modal is rendered in its closed\n // (faded/scaled-down) state before the CSS transition begins.\n raf1 = requestAnimationFrame(() => {\n raf2 = requestAnimationFrame(() => setIsVisible(true));\n });\n } else {\n setIsVisible(false);\n timerId = setTimeout(() => setIsMounted(false), TRANSITION_MS);\n }\n\n return () => {\n cancelAnimationFrame(raf1);\n cancelAnimationFrame(raf2);\n clearTimeout(timerId);\n };\n }, [isOpen]);\n\n // Handle escape key\n const handleEscapeKey = useCallback(\n (event: KeyboardEvent) => {\n if (closeOnEscape && event.key === 'Escape' && isOpen) {\n onClose();\n }\n },\n [closeOnEscape, isOpen, onClose],\n );\n\n // Handle backdrop click\n const handleBackdropClick = useCallback(\n (event: React.MouseEvent) => {\n if (closeOnBackdropClick && event.target === event.currentTarget) {\n onClose();\n }\n },\n [closeOnBackdropClick, onClose],\n );\n\n // Add/remove escape key listener (tied to isOpen, not isMounted)\n useEffect(() => {\n if (isOpen) {\n document.addEventListener('keydown', handleEscapeKey);\n // Prevent body scroll when modal is open\n document.body.style.overflow = 'hidden';\n }\n\n return () => {\n document.removeEventListener('keydown', handleEscapeKey);\n document.body.style.overflow = '';\n };\n }, [isOpen, handleEscapeKey]);\n\n // Keyed to `isVisible`, not `isOpen` and not `isMounted`.\n //\n // `isOpen` alone is too early: `isMounted` is set in the effect above, one\n // render later, so the dialog element does not exist yet and the trap would\n // run against a null ref.\n //\n // `isMounted` is *also* too early, and fails more quietly. `.eidos-modal`\n // starts at `visibility: hidden` and only becomes visible with\n // `--is-open`, which is two animation frames later - so at mount there is\n // nothing focusable to find and `.focus()` on the dialog itself is a no-op.\n // Focus silently stayed on the trigger.\n // `isClient` is part of the gate, not just the render below: a modal that\n // starts open flips `isVisible` before the portal exists, so the hook would\n // find a null ref, return early, and never re-run - leaving focus outside a\n // dialog claiming `aria-modal`.\n useDialogFocus(isClient && isOpen && isVisible, dialogRef);\n\n // `isMounted` is initialised to `isOpen`, so a modal that starts open reaches\n // `createPortal` on its very first render - which throws under SSR, where\n // there is no `document`. The animation flag cannot cover that; `isClient`\n // can. See `useIsClient`.\n if (!isClient || !isMounted) return null;\n\n const modalContent = (\n <div className={`eidos-modal ${isVisible ? 'eidos-modal--is-open' : ''} ${className}`}>\n <div className=\"eidos-modal-backdrop\" onClick={handleBackdropClick} aria-hidden=\"true\" />\n <div\n ref={dialogRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={bodyId}\n className={`eidos-modal-content eidos-modal-content--${size}`}\n >\n {title && (\n <div className={`eidos-modal-header ${type ? `eidos-modal-header--${type}` : ''}`}>\n <h4 id={titleId}>\n {icon && renderIcon(icon, 'eidos-modal-icon')} {title}\n </h4>\n </div>\n )}\n\n <div id={bodyId} className=\"eidos-modal-body\">\n {children}\n </div>\n\n {actions.length > 0 && (\n <div className={`eidos-modal-footer`}>\n {actions.map((action) => (\n <Button\n key={action.id}\n variant={action.variant || 'outlined'}\n size={action.size || 'md'}\n color={action.color}\n disabled={action.disabled}\n loading={action.loading}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n ))}\n </div>\n )}\n </div>\n </div>\n );\n\n return createPortal(modalContent, document.body);\n};\n\nModal.displayName = 'Modal';\n"]}
1
+ {"version":3,"sources":["/home/runner/work/eidos-ui/eidos-ui/dist/chunk-AFGC62AL.cjs","../src/components/Modal/Modal.component.tsx"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACTA,8BAAuE;AACvE,qCAA6B;AAyHvB,+CAAA;AApHC,IAAM,MAAA,EAA8B,CAAC;AAAA,EAC1C,MAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA,EAAU,CAAC,CAAA;AAAA,EACX,qBAAA,EAAuB,IAAA;AAAA,EACvB,cAAA,EAAgB,IAAA;AAAA,EAChB,KAAA,EAAO,IAAA;AAAA,EACP,UAAA,EAAY;AACd,CAAA,EAAA,GAAM;AACJ,EAAA,MAAM,QAAA,EAAU,0BAAA,CAAM;AACtB,EAAA,MAAM,OAAA,EAAS,0BAAA,CAAM;AACrB,EAAA,MAAM,UAAA,EAAY,2BAAA,IAA2B,CAAA;AAC7C,EAAA,MAAM,SAAA,EAAW,2CAAA,CAAY;AAW7B,EAAA,MAAM,cAAA,EAAgB,GAAA;AACtB,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,EAAA,EAAI,6BAAA,MAAe,CAAA;AACjD,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,EAAA,EAAI,6BAAA,MAAe,CAAA;AAEjD,EAAA,8BAAA,CAAU,EAAA,GAAM;AACd,IAAA,IAAI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;AACA;AACA;AACA","file":"/home/runner/work/eidos-ui/eidos-ui/dist/chunk-AFGC62AL.cjs","sourcesContent":[null,"import React, { useEffect, useCallback, useId, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { Button } from '../Button/Button.component';\nimport type { ModalProps } from './Modal.types';\nimport { renderIcon, useDialogFocus, useIsClient } from '../../utils';\n\nexport const Modal: React.FC<ModalProps> = ({\n isOpen,\n onClose,\n title,\n icon,\n type,\n children,\n actions = [],\n closeOnBackdropClick = true,\n closeOnEscape = true,\n size = 'md',\n className = '',\n}) => {\n const titleId = useId();\n const bodyId = useId();\n const dialogRef = useRef<HTMLDivElement>(null);\n const isClient = useIsClient();\n\n // ── Animation state ────────────────────────────────────────────────────────\n // isMounted: whether the portal DOM node exists at all.\n // isVisible: whether the '--is-open' CSS class is applied (drives the transition).\n //\n // On open: mount first → one rAF → apply --is-open (browser sees the\n // initial faded/scaled-down state before transitioning, so the\n // animation fires instead of just painting straight into \"open\").\n // On close: remove --is-open (CSS transition plays) → after 200 ms unmount.\n // 200 ms matches the CSS `transition: 0.2s` in Modal.scss.\n const TRANSITION_MS = 200;\n const [isMounted, setIsMounted] = useState(isOpen);\n const [isVisible, setIsVisible] = useState(isOpen);\n\n useEffect(() => {\n let raf1 = 0;\n let raf2 = 0;\n let timerId: ReturnType<typeof setTimeout>;\n\n if (isOpen) {\n setIsMounted(true);\n // Double rAF: React 18 automatic batching means setIsMounted(true) may\n // not produce a committed browser paint before the first rAF fires.\n // The second frame guarantees the modal is rendered in its closed\n // (faded/scaled-down) state before the CSS transition begins.\n raf1 = requestAnimationFrame(() => {\n raf2 = requestAnimationFrame(() => setIsVisible(true));\n });\n } else {\n setIsVisible(false);\n timerId = setTimeout(() => setIsMounted(false), TRANSITION_MS);\n }\n\n return () => {\n cancelAnimationFrame(raf1);\n cancelAnimationFrame(raf2);\n clearTimeout(timerId);\n };\n }, [isOpen]);\n\n // Handle escape key\n const handleEscapeKey = useCallback(\n (event: KeyboardEvent) => {\n if (closeOnEscape && event.key === 'Escape' && isOpen) {\n onClose();\n }\n },\n [closeOnEscape, isOpen, onClose],\n );\n\n // Handle backdrop click\n const handleBackdropClick = useCallback(\n (event: React.MouseEvent) => {\n if (closeOnBackdropClick && event.target === event.currentTarget) {\n onClose();\n }\n },\n [closeOnBackdropClick, onClose],\n );\n\n // Add/remove escape key listener (tied to isOpen, not isMounted)\n useEffect(() => {\n if (isOpen) {\n document.addEventListener('keydown', handleEscapeKey);\n // Prevent body scroll when modal is open\n document.body.style.overflow = 'hidden';\n }\n\n return () => {\n document.removeEventListener('keydown', handleEscapeKey);\n document.body.style.overflow = '';\n };\n }, [isOpen, handleEscapeKey]);\n\n // Keyed to `isVisible`, not `isOpen` and not `isMounted`.\n //\n // `isOpen` alone is too early: `isMounted` is set in the effect above, one\n // render later, so the dialog element does not exist yet and the trap would\n // run against a null ref.\n //\n // `isMounted` is *also* too early, and fails more quietly. `.eidos-modal`\n // starts at `visibility: hidden` and only becomes visible with\n // `--is-open`, which is two animation frames later - so at mount there is\n // nothing focusable to find and `.focus()` on the dialog itself is a no-op.\n // Focus silently stayed on the trigger.\n // `isClient` is part of the gate, not just the render below: a modal that\n // starts open flips `isVisible` before the portal exists, so the hook would\n // find a null ref, return early, and never re-run - leaving focus outside a\n // dialog claiming `aria-modal`.\n useDialogFocus(isClient && isOpen && isVisible, dialogRef);\n\n // `isMounted` is initialised to `isOpen`, so a modal that starts open reaches\n // `createPortal` on its very first render - which throws under SSR, where\n // there is no `document`. The animation flag cannot cover that; `isClient`\n // can. See `useIsClient`.\n if (!isClient || !isMounted) return null;\n\n const modalContent = (\n <div className={`eidos-modal ${isVisible ? 'eidos-modal--is-open' : ''} ${className}`}>\n <div className=\"eidos-modal-backdrop\" onClick={handleBackdropClick} aria-hidden=\"true\" />\n <div\n ref={dialogRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={bodyId}\n className={`eidos-modal-content eidos-modal-content--${size}`}\n >\n {title && (\n <div className={`eidos-modal-header ${type ? `eidos-modal-header--${type}` : ''}`}>\n <h4 id={titleId}>\n {icon && renderIcon(icon, 'eidos-modal-icon')} {title}\n </h4>\n </div>\n )}\n\n <div id={bodyId} className=\"eidos-modal-body\">\n {children}\n </div>\n\n {actions.length > 0 && (\n <div className={`eidos-modal-footer`}>\n {actions.map((action) => (\n <Button\n key={action.id}\n variant={action.variant || 'outlined'}\n size={action.size || 'md'}\n color={action.color}\n disabled={action.disabled}\n loading={action.loading}\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n ))}\n </div>\n )}\n </div>\n </div>\n );\n\n return createPortal(modalContent, document.body);\n};\n\nModal.displayName = 'Modal';\n"]}
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  CommandPalette
3
- } from "./chunk-4V2XYUQL.js";
3
+ } from "./chunk-GLEPKX2R.js";
4
4
  import {
5
5
  Menu
6
- } from "./chunk-WHQGJHMD.js";
6
+ } from "./chunk-TOLNPD7S.js";
7
7
  import {
8
8
  Avatar
9
9
  } from "./chunk-XJBWFDDE.js";
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-26PRBZA6.js";
13
13
  import {
14
14
  IconButton
15
- } from "./chunk-JY77VJAZ.js";
15
+ } from "./chunk-GHUEVNNU.js";
16
16
 
17
17
  // src/components/Toolbar/Toolbar.component.tsx
18
18
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -42,4 +42,4 @@ var Toolbar = ({
42
42
  export {
43
43
  Toolbar
44
44
  };
45
- //# sourceMappingURL=chunk-U4SVBE2M.js.map
45
+ //# sourceMappingURL=chunk-AWPJH3UB.js.map