@liveblocks/react-ui 1.12.0-initial1

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 (391) hide show
  1. package/README.md +65 -0
  2. package/dist/components/Comment.js +473 -0
  3. package/dist/components/Comment.js.map +1 -0
  4. package/dist/components/Comment.mjs +447 -0
  5. package/dist/components/Comment.mjs.map +1 -0
  6. package/dist/components/Composer.js +299 -0
  7. package/dist/components/Composer.js.map +1 -0
  8. package/dist/components/Composer.mjs +297 -0
  9. package/dist/components/Composer.mjs.map +1 -0
  10. package/dist/components/InboxNotification.js +374 -0
  11. package/dist/components/InboxNotification.js.map +1 -0
  12. package/dist/components/InboxNotification.mjs +372 -0
  13. package/dist/components/InboxNotification.mjs.map +1 -0
  14. package/dist/components/InboxNotificationList.js +19 -0
  15. package/dist/components/InboxNotificationList.js.map +1 -0
  16. package/dist/components/InboxNotificationList.mjs +17 -0
  17. package/dist/components/InboxNotificationList.mjs.map +1 -0
  18. package/dist/components/Thread.js +188 -0
  19. package/dist/components/Thread.js.map +1 -0
  20. package/dist/components/Thread.mjs +167 -0
  21. package/dist/components/Thread.mjs.map +1 -0
  22. package/dist/components/internal/Attribution.js +26 -0
  23. package/dist/components/internal/Attribution.js.map +1 -0
  24. package/dist/components/internal/Attribution.mjs +24 -0
  25. package/dist/components/internal/Attribution.mjs.map +1 -0
  26. package/dist/components/internal/Avatar.js +40 -0
  27. package/dist/components/internal/Avatar.js.map +1 -0
  28. package/dist/components/internal/Avatar.mjs +38 -0
  29. package/dist/components/internal/Avatar.mjs.map +1 -0
  30. package/dist/components/internal/Button.js +24 -0
  31. package/dist/components/internal/Button.js.map +1 -0
  32. package/dist/components/internal/Button.mjs +22 -0
  33. package/dist/components/internal/Button.mjs.map +1 -0
  34. package/dist/components/internal/Dropdown.js +72 -0
  35. package/dist/components/internal/Dropdown.js.map +1 -0
  36. package/dist/components/internal/Dropdown.mjs +47 -0
  37. package/dist/components/internal/Dropdown.mjs.map +1 -0
  38. package/dist/components/internal/Emoji.js +18 -0
  39. package/dist/components/internal/Emoji.js.map +1 -0
  40. package/dist/components/internal/Emoji.mjs +16 -0
  41. package/dist/components/internal/Emoji.mjs.map +1 -0
  42. package/dist/components/internal/EmojiPicker.js +186 -0
  43. package/dist/components/internal/EmojiPicker.js.map +1 -0
  44. package/dist/components/internal/EmojiPicker.mjs +162 -0
  45. package/dist/components/internal/EmojiPicker.mjs.map +1 -0
  46. package/dist/components/internal/Icon.js +28 -0
  47. package/dist/components/internal/Icon.js.map +1 -0
  48. package/dist/components/internal/Icon.mjs +24 -0
  49. package/dist/components/internal/Icon.mjs.map +1 -0
  50. package/dist/components/internal/InboxNotificationThread.js +116 -0
  51. package/dist/components/internal/InboxNotificationThread.js.map +1 -0
  52. package/dist/components/internal/InboxNotificationThread.mjs +112 -0
  53. package/dist/components/internal/InboxNotificationThread.mjs.map +1 -0
  54. package/dist/components/internal/List.js +34 -0
  55. package/dist/components/internal/List.js.map +1 -0
  56. package/dist/components/internal/List.mjs +32 -0
  57. package/dist/components/internal/List.mjs.map +1 -0
  58. package/dist/components/internal/Room.js +22 -0
  59. package/dist/components/internal/Room.js.map +1 -0
  60. package/dist/components/internal/Room.mjs +20 -0
  61. package/dist/components/internal/Room.mjs.map +1 -0
  62. package/dist/components/internal/Tooltip.js +91 -0
  63. package/dist/components/internal/Tooltip.js.map +1 -0
  64. package/dist/components/internal/Tooltip.mjs +65 -0
  65. package/dist/components/internal/Tooltip.mjs.map +1 -0
  66. package/dist/components/internal/User.js +41 -0
  67. package/dist/components/internal/User.js.map +1 -0
  68. package/dist/components/internal/User.mjs +39 -0
  69. package/dist/components/internal/User.mjs.map +1 -0
  70. package/dist/components.js +64 -0
  71. package/dist/components.js.map +1 -0
  72. package/dist/components.mjs +41 -0
  73. package/dist/components.mjs.map +1 -0
  74. package/dist/config.js +33 -0
  75. package/dist/config.js.map +1 -0
  76. package/dist/config.mjs +30 -0
  77. package/dist/config.mjs.map +1 -0
  78. package/dist/constants.js +10 -0
  79. package/dist/constants.js.map +1 -0
  80. package/dist/constants.mjs +6 -0
  81. package/dist/constants.mjs.map +1 -0
  82. package/dist/icons/ArrowDown.js +15 -0
  83. package/dist/icons/ArrowDown.js.map +1 -0
  84. package/dist/icons/ArrowDown.mjs +13 -0
  85. package/dist/icons/ArrowDown.mjs.map +1 -0
  86. package/dist/icons/Check.js +15 -0
  87. package/dist/icons/Check.js.map +1 -0
  88. package/dist/icons/Check.mjs +13 -0
  89. package/dist/icons/Check.mjs.map +1 -0
  90. package/dist/icons/Cross.js +17 -0
  91. package/dist/icons/Cross.js.map +1 -0
  92. package/dist/icons/Cross.mjs +15 -0
  93. package/dist/icons/Cross.mjs.map +1 -0
  94. package/dist/icons/Delete.js +15 -0
  95. package/dist/icons/Delete.js.map +1 -0
  96. package/dist/icons/Delete.mjs +13 -0
  97. package/dist/icons/Delete.mjs.map +1 -0
  98. package/dist/icons/Edit.js +15 -0
  99. package/dist/icons/Edit.js.map +1 -0
  100. package/dist/icons/Edit.mjs +13 -0
  101. package/dist/icons/Edit.mjs.map +1 -0
  102. package/dist/icons/Ellipsis.js +26 -0
  103. package/dist/icons/Ellipsis.js.map +1 -0
  104. package/dist/icons/Ellipsis.mjs +24 -0
  105. package/dist/icons/Ellipsis.mjs.map +1 -0
  106. package/dist/icons/Emoji.js +27 -0
  107. package/dist/icons/Emoji.js.map +1 -0
  108. package/dist/icons/Emoji.mjs +25 -0
  109. package/dist/icons/Emoji.mjs.map +1 -0
  110. package/dist/icons/EmojiAdd.js +29 -0
  111. package/dist/icons/EmojiAdd.js.map +1 -0
  112. package/dist/icons/EmojiAdd.mjs +27 -0
  113. package/dist/icons/EmojiAdd.mjs.map +1 -0
  114. package/dist/icons/Mention.js +17 -0
  115. package/dist/icons/Mention.js.map +1 -0
  116. package/dist/icons/Mention.mjs +15 -0
  117. package/dist/icons/Mention.mjs.map +1 -0
  118. package/dist/icons/Missing.js +19 -0
  119. package/dist/icons/Missing.js.map +1 -0
  120. package/dist/icons/Missing.mjs +17 -0
  121. package/dist/icons/Missing.mjs.map +1 -0
  122. package/dist/icons/Resolve.js +19 -0
  123. package/dist/icons/Resolve.js.map +1 -0
  124. package/dist/icons/Resolve.mjs +17 -0
  125. package/dist/icons/Resolve.mjs.map +1 -0
  126. package/dist/icons/Resolved.js +21 -0
  127. package/dist/icons/Resolved.js.map +1 -0
  128. package/dist/icons/Resolved.mjs +19 -0
  129. package/dist/icons/Resolved.mjs.map +1 -0
  130. package/dist/icons/Search.js +15 -0
  131. package/dist/icons/Search.js.map +1 -0
  132. package/dist/icons/Search.mjs +13 -0
  133. package/dist/icons/Search.mjs.map +1 -0
  134. package/dist/icons/Send.js +15 -0
  135. package/dist/icons/Send.js.map +1 -0
  136. package/dist/icons/Send.mjs +13 -0
  137. package/dist/icons/Send.mjs.map +1 -0
  138. package/dist/icons/Spinner.js +22 -0
  139. package/dist/icons/Spinner.js.map +1 -0
  140. package/dist/icons/Spinner.mjs +20 -0
  141. package/dist/icons/Spinner.mjs.map +1 -0
  142. package/dist/index.d.mts +476 -0
  143. package/dist/index.d.ts +476 -0
  144. package/dist/index.js +20 -0
  145. package/dist/index.js.map +1 -0
  146. package/dist/index.mjs +11 -0
  147. package/dist/index.mjs.map +1 -0
  148. package/dist/overrides.js +100 -0
  149. package/dist/overrides.js.map +1 -0
  150. package/dist/overrides.mjs +77 -0
  151. package/dist/overrides.mjs.map +1 -0
  152. package/dist/primitives/Comment/index.js +113 -0
  153. package/dist/primitives/Comment/index.js.map +1 -0
  154. package/dist/primitives/Comment/index.mjs +109 -0
  155. package/dist/primitives/Comment/index.mjs.map +1 -0
  156. package/dist/primitives/Comment/utils.js +25 -0
  157. package/dist/primitives/Comment/utils.js.map +1 -0
  158. package/dist/primitives/Comment/utils.mjs +20 -0
  159. package/dist/primitives/Comment/utils.mjs.map +1 -0
  160. package/dist/primitives/Composer/contexts.js +34 -0
  161. package/dist/primitives/Composer/contexts.js.map +1 -0
  162. package/dist/primitives/Composer/contexts.mjs +27 -0
  163. package/dist/primitives/Composer/contexts.mjs.map +1 -0
  164. package/dist/primitives/Composer/index.js +771 -0
  165. package/dist/primitives/Composer/index.js.map +1 -0
  166. package/dist/primitives/Composer/index.mjs +762 -0
  167. package/dist/primitives/Composer/index.mjs.map +1 -0
  168. package/dist/primitives/Composer/utils.js +102 -0
  169. package/dist/primitives/Composer/utils.js.map +1 -0
  170. package/dist/primitives/Composer/utils.mjs +93 -0
  171. package/dist/primitives/Composer/utils.mjs.map +1 -0
  172. package/dist/primitives/EmojiPicker/contexts.js +19 -0
  173. package/dist/primitives/EmojiPicker/contexts.js.map +1 -0
  174. package/dist/primitives/EmojiPicker/contexts.mjs +16 -0
  175. package/dist/primitives/EmojiPicker/contexts.mjs.map +1 -0
  176. package/dist/primitives/EmojiPicker/index.js +434 -0
  177. package/dist/primitives/EmojiPicker/index.js.map +1 -0
  178. package/dist/primitives/EmojiPicker/index.mjs +430 -0
  179. package/dist/primitives/EmojiPicker/index.mjs.map +1 -0
  180. package/dist/primitives/EmojiPicker/utils.js +329 -0
  181. package/dist/primitives/EmojiPicker/utils.js.map +1 -0
  182. package/dist/primitives/EmojiPicker/utils.mjs +325 -0
  183. package/dist/primitives/EmojiPicker/utils.mjs.map +1 -0
  184. package/dist/primitives/Timestamp.js +121 -0
  185. package/dist/primitives/Timestamp.js.map +1 -0
  186. package/dist/primitives/Timestamp.mjs +119 -0
  187. package/dist/primitives/Timestamp.mjs.map +1 -0
  188. package/dist/primitives/index.d.mts +502 -0
  189. package/dist/primitives/index.d.ts +502 -0
  190. package/dist/primitives/index.js +16 -0
  191. package/dist/primitives/index.js.map +1 -0
  192. package/dist/primitives/index.mjs +9 -0
  193. package/dist/primitives/index.mjs.map +1 -0
  194. package/dist/primitives/internal/Emoji.js +30 -0
  195. package/dist/primitives/internal/Emoji.js.map +1 -0
  196. package/dist/primitives/internal/Emoji.mjs +28 -0
  197. package/dist/primitives/internal/Emoji.mjs.map +1 -0
  198. package/dist/shared.js +21 -0
  199. package/dist/shared.js.map +1 -0
  200. package/dist/shared.mjs +19 -0
  201. package/dist/shared.mjs.map +1 -0
  202. package/dist/slate/plugins/auto-formatting.js +83 -0
  203. package/dist/slate/plugins/auto-formatting.js.map +1 -0
  204. package/dist/slate/plugins/auto-formatting.mjs +81 -0
  205. package/dist/slate/plugins/auto-formatting.mjs.map +1 -0
  206. package/dist/slate/plugins/auto-links.js +175 -0
  207. package/dist/slate/plugins/auto-links.js.map +1 -0
  208. package/dist/slate/plugins/auto-links.mjs +172 -0
  209. package/dist/slate/plugins/auto-links.mjs.map +1 -0
  210. package/dist/slate/plugins/empty-clear-formatting.js +18 -0
  211. package/dist/slate/plugins/empty-clear-formatting.js.map +1 -0
  212. package/dist/slate/plugins/empty-clear-formatting.mjs +16 -0
  213. package/dist/slate/plugins/empty-clear-formatting.mjs.map +1 -0
  214. package/dist/slate/plugins/mentions.js +112 -0
  215. package/dist/slate/plugins/mentions.js.map +1 -0
  216. package/dist/slate/plugins/mentions.mjs +105 -0
  217. package/dist/slate/plugins/mentions.mjs.map +1 -0
  218. package/dist/slate/utils/get-character.js +50 -0
  219. package/dist/slate/utils/get-character.js.map +1 -0
  220. package/dist/slate/utils/get-character.mjs +47 -0
  221. package/dist/slate/utils/get-character.mjs.map +1 -0
  222. package/dist/slate/utils/get-dom-range.js +17 -0
  223. package/dist/slate/utils/get-dom-range.js.map +1 -0
  224. package/dist/slate/utils/get-dom-range.mjs +15 -0
  225. package/dist/slate/utils/get-dom-range.mjs.map +1 -0
  226. package/dist/slate/utils/get-match-range.js +53 -0
  227. package/dist/slate/utils/get-match-range.js.map +1 -0
  228. package/dist/slate/utils/get-match-range.mjs +51 -0
  229. package/dist/slate/utils/get-match-range.mjs.map +1 -0
  230. package/dist/slate/utils/is-empty-string.js +8 -0
  231. package/dist/slate/utils/is-empty-string.js.map +1 -0
  232. package/dist/slate/utils/is-empty-string.mjs +6 -0
  233. package/dist/slate/utils/is-empty-string.mjs.map +1 -0
  234. package/dist/slate/utils/is-empty.js +10 -0
  235. package/dist/slate/utils/is-empty.js.map +1 -0
  236. package/dist/slate/utils/is-empty.mjs +8 -0
  237. package/dist/slate/utils/is-empty.mjs.map +1 -0
  238. package/dist/slate/utils/is-selection-collapsed.js +10 -0
  239. package/dist/slate/utils/is-selection-collapsed.js.map +1 -0
  240. package/dist/slate/utils/is-selection-collapsed.mjs +8 -0
  241. package/dist/slate/utils/is-selection-collapsed.mjs.map +1 -0
  242. package/dist/slate/utils/marks.js +43 -0
  243. package/dist/slate/utils/marks.js.map +1 -0
  244. package/dist/slate/utils/marks.mjs +38 -0
  245. package/dist/slate/utils/marks.mjs.map +1 -0
  246. package/dist/utils/Persist.js +85 -0
  247. package/dist/utils/Persist.js.map +1 -0
  248. package/dist/utils/Persist.mjs +81 -0
  249. package/dist/utils/Persist.mjs.map +1 -0
  250. package/dist/utils/Portal.js +27 -0
  251. package/dist/utils/Portal.js.map +1 -0
  252. package/dist/utils/Portal.mjs +25 -0
  253. package/dist/utils/Portal.mjs.map +1 -0
  254. package/dist/utils/capitalize.js +8 -0
  255. package/dist/utils/capitalize.js.map +1 -0
  256. package/dist/utils/capitalize.mjs +6 -0
  257. package/dist/utils/capitalize.mjs.map +1 -0
  258. package/dist/utils/chunk.js +12 -0
  259. package/dist/utils/chunk.js.map +1 -0
  260. package/dist/utils/chunk.mjs +10 -0
  261. package/dist/utils/chunk.mjs.map +1 -0
  262. package/dist/utils/clamp.js +8 -0
  263. package/dist/utils/clamp.js.map +1 -0
  264. package/dist/utils/clamp.mjs +6 -0
  265. package/dist/utils/clamp.mjs.map +1 -0
  266. package/dist/utils/class-names.js +8 -0
  267. package/dist/utils/class-names.js.map +1 -0
  268. package/dist/utils/class-names.mjs +6 -0
  269. package/dist/utils/class-names.mjs.map +1 -0
  270. package/dist/utils/exists.js +8 -0
  271. package/dist/utils/exists.js.map +1 -0
  272. package/dist/utils/exists.mjs +6 -0
  273. package/dist/utils/exists.mjs.map +1 -0
  274. package/dist/utils/find-last-index.js +15 -0
  275. package/dist/utils/find-last-index.js.map +1 -0
  276. package/dist/utils/find-last-index.mjs +13 -0
  277. package/dist/utils/find-last-index.mjs.map +1 -0
  278. package/dist/utils/flush-sync.js +12 -0
  279. package/dist/utils/flush-sync.js.map +1 -0
  280. package/dist/utils/flush-sync.mjs +10 -0
  281. package/dist/utils/flush-sync.mjs.map +1 -0
  282. package/dist/utils/get-initials.js +13 -0
  283. package/dist/utils/get-initials.js.map +1 -0
  284. package/dist/utils/get-initials.mjs +11 -0
  285. package/dist/utils/get-initials.mjs.map +1 -0
  286. package/dist/utils/intl.js +24 -0
  287. package/dist/utils/intl.js.map +1 -0
  288. package/dist/utils/intl.mjs +20 -0
  289. package/dist/utils/intl.mjs.map +1 -0
  290. package/dist/utils/is-apple.js +9 -0
  291. package/dist/utils/is-apple.js.map +1 -0
  292. package/dist/utils/is-apple.mjs +7 -0
  293. package/dist/utils/is-apple.mjs.map +1 -0
  294. package/dist/utils/is-key.js +26 -0
  295. package/dist/utils/is-key.js.map +1 -0
  296. package/dist/utils/is-key.mjs +24 -0
  297. package/dist/utils/is-key.mjs.map +1 -0
  298. package/dist/utils/memoize.js +19 -0
  299. package/dist/utils/memoize.js.map +1 -0
  300. package/dist/utils/memoize.mjs +17 -0
  301. package/dist/utils/memoize.mjs.map +1 -0
  302. package/dist/utils/pluralize.js +8 -0
  303. package/dist/utils/pluralize.js.map +1 -0
  304. package/dist/utils/pluralize.mjs +6 -0
  305. package/dist/utils/pluralize.mjs.map +1 -0
  306. package/dist/utils/request-idle-callback.js +15 -0
  307. package/dist/utils/request-idle-callback.js.map +1 -0
  308. package/dist/utils/request-idle-callback.mjs +12 -0
  309. package/dist/utils/request-idle-callback.mjs.map +1 -0
  310. package/dist/utils/request-submit.js +20 -0
  311. package/dist/utils/request-submit.js.map +1 -0
  312. package/dist/utils/request-submit.mjs +18 -0
  313. package/dist/utils/request-submit.mjs.map +1 -0
  314. package/dist/utils/url.js +22 -0
  315. package/dist/utils/url.js.map +1 -0
  316. package/dist/utils/url.mjs +20 -0
  317. package/dist/utils/url.mjs.map +1 -0
  318. package/dist/utils/use-controllable-state.js +34 -0
  319. package/dist/utils/use-controllable-state.js.map +1 -0
  320. package/dist/utils/use-controllable-state.mjs +32 -0
  321. package/dist/utils/use-controllable-state.mjs.map +1 -0
  322. package/dist/utils/use-id.js +29 -0
  323. package/dist/utils/use-id.js.map +1 -0
  324. package/dist/utils/use-id.mjs +27 -0
  325. package/dist/utils/use-id.mjs.map +1 -0
  326. package/dist/utils/use-index.js +32 -0
  327. package/dist/utils/use-index.js.map +1 -0
  328. package/dist/utils/use-index.mjs +30 -0
  329. package/dist/utils/use-index.mjs.map +1 -0
  330. package/dist/utils/use-initial.js +10 -0
  331. package/dist/utils/use-initial.js.map +1 -0
  332. package/dist/utils/use-initial.mjs +8 -0
  333. package/dist/utils/use-initial.mjs.map +1 -0
  334. package/dist/utils/use-interval.js +24 -0
  335. package/dist/utils/use-interval.js.map +1 -0
  336. package/dist/utils/use-interval.mjs +22 -0
  337. package/dist/utils/use-interval.mjs.map +1 -0
  338. package/dist/utils/use-latest.js +14 -0
  339. package/dist/utils/use-latest.js.map +1 -0
  340. package/dist/utils/use-latest.mjs +12 -0
  341. package/dist/utils/use-latest.mjs.map +1 -0
  342. package/dist/utils/use-layout-effect.js +8 -0
  343. package/dist/utils/use-layout-effect.js.map +1 -0
  344. package/dist/utils/use-layout-effect.mjs +6 -0
  345. package/dist/utils/use-layout-effect.mjs.map +1 -0
  346. package/dist/utils/use-refs.js +24 -0
  347. package/dist/utils/use-refs.js.map +1 -0
  348. package/dist/utils/use-refs.mjs +22 -0
  349. package/dist/utils/use-refs.mjs.map +1 -0
  350. package/dist/utils/use-rerender.js +14 -0
  351. package/dist/utils/use-rerender.js.map +1 -0
  352. package/dist/utils/use-rerender.mjs +12 -0
  353. package/dist/utils/use-rerender.mjs.map +1 -0
  354. package/dist/utils/use-transition.js +12 -0
  355. package/dist/utils/use-transition.js.map +1 -0
  356. package/dist/utils/use-transition.mjs +10 -0
  357. package/dist/utils/use-transition.mjs.map +1 -0
  358. package/dist/utils/use-visible.js +48 -0
  359. package/dist/utils/use-visible.js.map +1 -0
  360. package/dist/utils/use-visible.mjs +46 -0
  361. package/dist/utils/use-visible.mjs.map +1 -0
  362. package/dist/utils/visually-hidden.js +17 -0
  363. package/dist/utils/visually-hidden.js.map +1 -0
  364. package/dist/utils/visually-hidden.mjs +15 -0
  365. package/dist/utils/visually-hidden.mjs.map +1 -0
  366. package/dist/utils/wrap.js +9 -0
  367. package/dist/utils/wrap.js.map +1 -0
  368. package/dist/utils/wrap.mjs +7 -0
  369. package/dist/utils/wrap.mjs.map +1 -0
  370. package/dist/version.js +10 -0
  371. package/dist/version.js.map +1 -0
  372. package/dist/version.mjs +6 -0
  373. package/dist/version.mjs.map +1 -0
  374. package/package.json +142 -0
  375. package/primitives/README.md +5 -0
  376. package/primitives/package.json +4 -0
  377. package/src/styles/constants.css +17 -0
  378. package/src/styles/dark/attributes.css +8 -0
  379. package/src/styles/dark/index.css +29 -0
  380. package/src/styles/dark/media-query.css +7 -0
  381. package/src/styles/index.css +1437 -0
  382. package/src/styles/utils.css +36 -0
  383. package/styles/dark/attributes.css +1 -0
  384. package/styles/dark/attributes.css.d.ts +1 -0
  385. package/styles/dark/attributes.css.map +1 -0
  386. package/styles/dark/media-query.css +1 -0
  387. package/styles/dark/media-query.css.d.ts +1 -0
  388. package/styles/dark/media-query.css.map +1 -0
  389. package/styles.css +1 -0
  390. package/styles.css.d.ts +1 -0
  391. package/styles.css.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Thread.js","sources":["../../src/components/Thread.tsx"],"sourcesContent":["\"use client\";\n\nimport type { BaseMetadata, CommentData, ThreadData } from \"@liveblocks/core\";\nimport { useRoomContextBundle } from \"@liveblocks/react\";\nimport * as TogglePrimitive from \"@radix-ui/react-toggle\";\nimport type {\n ComponentPropsWithoutRef,\n ForwardedRef,\n RefAttributes,\n SyntheticEvent,\n} from \"react\";\nimport React, {\n forwardRef,\n Fragment,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\n\nimport { ArrowDownIcon } from \"../icons/ArrowDown\";\nimport { ResolveIcon } from \"../icons/Resolve\";\nimport { ResolvedIcon } from \"../icons/Resolved\";\nimport type {\n CommentOverrides,\n ComposerOverrides,\n GlobalOverrides,\n ThreadOverrides,\n} from \"../overrides\";\nimport { useOverrides } from \"../overrides\";\nimport type { ThreadMetadata } from \"../types\";\nimport { classNames } from \"../utils/class-names\";\nimport { findLastIndex } from \"../utils/find-last-index\";\nimport type { CommentProps } from \"./Comment\";\nimport { Comment } from \"./Comment\";\nimport { Composer } from \"./Composer\";\nimport { Button } from \"./internal/Button\";\nimport { Tooltip, TooltipProvider } from \"./internal/Tooltip\";\n\nexport interface ThreadProps<M extends BaseMetadata = ThreadMetadata>\n extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The thread to display.\n */\n thread: ThreadData<M>;\n\n /**\n * How to show or hide the composer to reply to the thread.\n */\n showComposer?: boolean | \"collapsed\";\n\n /**\n * Whether to show the action to resolve the thread.\n */\n showResolveAction?: boolean;\n\n /**\n * How to show or hide the actions.\n */\n showActions?: CommentProps[\"showActions\"];\n\n /**\n * Whether to show reactions.\n */\n showReactions?: CommentProps[\"showReactions\"];\n\n /**\n * Whether to indent the comments' content.\n */\n indentCommentContent?: CommentProps[\"indentContent\"];\n\n /**\n * Whether to show deleted comments.\n */\n showDeletedComments?: CommentProps[\"showDeleted\"];\n\n /**\n * The event handler called when changing the resolved status.\n */\n onResolvedChange?: (resolved: boolean) => void;\n\n /**\n * The event handler called when a comment is edited.\n */\n onCommentEdit?: CommentProps[\"onCommentEdit\"];\n\n /**\n * The event handler called when a comment is deleted.\n */\n onCommentDelete?: CommentProps[\"onCommentDelete\"];\n\n /**\n * The event handler called when the thread is deleted.\n * A thread is deleted when all its comments are deleted.\n */\n onThreadDelete?: (thread: ThreadData<M>) => void;\n\n /**\n * The event handler called when clicking on a comment's author.\n */\n onAuthorClick?: CommentProps[\"onAuthorClick\"];\n\n /**\n * The event handler called when clicking on a mention.\n */\n onMentionClick?: CommentProps[\"onMentionClick\"];\n\n /**\n * Override the component's strings.\n */\n overrides?: Partial<\n GlobalOverrides & ThreadOverrides & CommentOverrides & ComposerOverrides\n >;\n}\n\n/**\n * Displays a thread of comments, with a composer to reply\n * to it.\n *\n * @example\n * <>\n * {threads.map((thread) => (\n * <Thread key={thread.id} thread={thread} />\n * ))}\n * </>\n */\nexport const Thread = forwardRef(\n <M extends BaseMetadata = ThreadMetadata>(\n {\n thread,\n indentCommentContent = true,\n showActions = \"hover\",\n showDeletedComments,\n showResolveAction = true,\n showReactions = true,\n showComposer = \"collapsed\",\n onResolvedChange,\n onCommentEdit,\n onCommentDelete,\n onThreadDelete,\n onAuthorClick,\n onMentionClick,\n overrides,\n className,\n ...props\n }: ThreadProps<M>,\n forwardedRef: ForwardedRef<HTMLDivElement>\n ) => {\n const { useEditThreadMetadata, useThreadSubscription } =\n useRoomContextBundle();\n const editThreadMetadata = useEditThreadMetadata();\n const $ = useOverrides(overrides);\n const firstCommentIndex = useMemo(() => {\n return showDeletedComments\n ? 0\n : thread.comments.findIndex((comment) => comment.body);\n }, [showDeletedComments, thread.comments]);\n const lastCommentIndex = useMemo(() => {\n return showDeletedComments\n ? thread.comments.length - 1\n : findLastIndex(thread.comments, (comment) => comment.body);\n }, [showDeletedComments, thread.comments]);\n const { status: subscriptionStatus, unreadSince } = useThreadSubscription(\n thread.id\n );\n const unreadIndex = useMemo(() => {\n // The user is not subscribed to this thread.\n if (subscriptionStatus !== \"subscribed\") {\n return;\n }\n\n // The user hasn't read the thread yet, so all comments are unread.\n if (unreadSince === null) {\n return firstCommentIndex;\n }\n\n // The user has read the thread, so we find the first unread comment.\n const unreadIndex = thread.comments.findIndex(\n (comment) =>\n (showDeletedComments ? true : comment.body) &&\n comment.createdAt > unreadSince\n );\n\n return unreadIndex >= 0 && unreadIndex < thread.comments.length\n ? unreadIndex\n : undefined;\n }, [\n firstCommentIndex,\n showDeletedComments,\n subscriptionStatus,\n thread.comments,\n unreadSince,\n ]);\n const [newIndex, setNewIndex] = useState<number>();\n const newIndicatorIndex = newIndex === undefined ? unreadIndex : newIndex;\n\n useEffect(() => {\n if (unreadIndex) {\n // Keep the \"new\" indicator at the lowest unread index.\n setNewIndex((persistedUnreadIndex) =>\n Math.min(persistedUnreadIndex ?? Infinity, unreadIndex)\n );\n }\n }, [unreadIndex]);\n\n const stopPropagation = useCallback((event: SyntheticEvent) => {\n event.stopPropagation();\n }, []);\n\n const handleResolvedChange = useCallback(\n (resolved: boolean) => {\n onResolvedChange?.(resolved);\n\n editThreadMetadata({ threadId: thread.id, metadata: { resolved } });\n },\n [editThreadMetadata, onResolvedChange, thread.id]\n );\n\n const handleCommentDelete = useCallback(\n (comment: CommentData) => {\n onCommentDelete?.(comment);\n\n const filteredComments = thread.comments.filter(\n (comment) => comment.body\n );\n\n if (filteredComments.length <= 1) {\n onThreadDelete?.(thread);\n }\n },\n [onCommentDelete, onThreadDelete, thread]\n );\n\n return (\n <TooltipProvider>\n <div\n className={classNames(\n \"lb-root lb-thread\",\n showActions === \"hover\" && \"lb-thread:show-actions-hover\",\n className\n )}\n data-resolved={\n (thread.metadata as ThreadMetadata).resolved ? \"\" : undefined\n }\n data-unread={unreadIndex !== undefined ? \"\" : undefined}\n dir={$.dir}\n {...props}\n ref={forwardedRef}\n >\n <div className=\"lb-thread-comments\">\n {thread.comments.map((comment, index) => {\n const isFirstComment = index === firstCommentIndex;\n const isUnread =\n unreadIndex !== undefined && index >= unreadIndex;\n\n const children = (\n <Comment\n key={comment.id}\n className=\"lb-thread-comment\"\n data-unread={isUnread ? \"\" : undefined}\n comment={comment}\n indentContent={indentCommentContent}\n showDeleted={showDeletedComments}\n showActions={showActions}\n showReactions={showReactions}\n onCommentEdit={onCommentEdit}\n onCommentDelete={handleCommentDelete}\n onAuthorClick={onAuthorClick}\n onMentionClick={onMentionClick}\n markThreadAsReadWhenVisible={\n index === lastCommentIndex && isUnread\n ? thread.id\n : undefined\n }\n additionalActionsClassName={\n isFirstComment ? \"lb-thread-actions\" : undefined\n }\n additionalActions={\n isFirstComment && showResolveAction ? (\n <Tooltip\n content={\n (thread.metadata as ThreadMetadata).resolved\n ? $.THREAD_UNRESOLVE\n : $.THREAD_RESOLVE\n }\n >\n <TogglePrimitive.Root\n pressed={(thread.metadata as ThreadMetadata).resolved}\n onPressedChange={handleResolvedChange}\n asChild\n >\n <Button\n className=\"lb-comment-action\"\n onClick={stopPropagation}\n aria-label={\n (thread.metadata as ThreadMetadata).resolved\n ? $.THREAD_UNRESOLVE\n : $.THREAD_RESOLVE\n }\n >\n {(thread.metadata as ThreadMetadata).resolved ? (\n <ResolvedIcon className=\"lb-button-icon\" />\n ) : (\n <ResolveIcon className=\"lb-button-icon\" />\n )}\n </Button>\n </TogglePrimitive.Root>\n </Tooltip>\n ) : null\n }\n />\n );\n\n return index === newIndicatorIndex &&\n newIndicatorIndex !== firstCommentIndex &&\n newIndicatorIndex <= lastCommentIndex ? (\n <Fragment key={comment.id}>\n <div\n className=\"lb-thread-new-indicator\"\n aria-label={$.THREAD_NEW_INDICATOR_DESCRIPTION}\n >\n <span className=\"lb-thread-new-indicator-label\">\n <ArrowDownIcon className=\"lb-thread-new-indicator-label-icon\" />\n {$.THREAD_NEW_INDICATOR}\n </span>\n </div>\n {children}\n </Fragment>\n ) : (\n children\n );\n })}\n </div>\n {showComposer && (\n <Composer\n className=\"lb-thread-composer\"\n threadId={thread.id}\n defaultCollapsed={showComposer === \"collapsed\" ? true : undefined}\n overrides={{\n COMPOSER_PLACEHOLDER: $.THREAD_COMPOSER_PLACEHOLDER,\n COMPOSER_SEND: $.THREAD_COMPOSER_SEND,\n }}\n />\n )}\n </div>\n </TooltipProvider>\n );\n }\n) as <M extends BaseMetadata = ThreadMetadata>(\n props: ThreadProps<M> & RefAttributes<HTMLDivElement>\n) => JSX.Element;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8HO;AAAe;AAElB;AACE;AACuB;AACT;AACd;AACoB;AACJ;AACD;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACG;AAIL;AAEA;AACA;AACA;AACE;AAEuD;AAEzD;AACE;AAE4D;AAE9D;AAAoD;AAC3C;AAET;AAEE;AACE;AAAA;AAIF;AACE;AAAO;AAIT;AAAoC;AAGZ;AAGxB;AAEI;AACH;AACD;AACA;AACA;AACO;AACP;AAEF;AACA;AAEA;AACE;AAEE;AAAA;AACwD;AACxD;AACF;AAGF;AACE;AAAsB;AAGxB;AAA6B;AAEzB;AAEA;AAAkE;AACpE;AACgD;AAGlD;AAA4B;AAExB;AAEA;AAAyC;AAClB;AAGvB;AACE;AAAuB;AACzB;AACF;AACwC;AAG1C;AAEK;AACY;AACT;AAC2B;AAC3B;AACF;AAEsD;AAER;AACvC;AACH;AACC;AAEJ;AAAc;AAEX;AACA;AAGA;AACG;AACc;AACH;AACmB;AAC7B;AACe;AACF;AACb;AACA;AACA;AACiB;AACjB;AACA;AAIM;AAGmC;AAIpC;AAIS;AAGP;AAC8C;AAC5B;AACV;AAEN;AACW;AACD;AAID;AAIL;AAAuB;AAEvB;AAAsB;AAK7B;AAKV;AAGG;AAAsB;AACpB;AACW;AACI;AAEb;AAAe;AACb;AAAwB;AAO/B;AAKH;AACW;AACO;AACuC;AAC7C;AACe;AACP;AACnB;AAIR;AAGN;;"}
@@ -0,0 +1,167 @@
1
+ 'use client';
2
+ import { useRoomContextBundle } from '@liveblocks/react';
3
+ import * as TogglePrimitive from '@radix-ui/react-toggle';
4
+ import React__default, { forwardRef, useMemo, useState, useEffect, useCallback, Fragment } from 'react';
5
+ import { ArrowDownIcon } from '../icons/ArrowDown.mjs';
6
+ import { ResolveIcon } from '../icons/Resolve.mjs';
7
+ import { ResolvedIcon } from '../icons/Resolved.mjs';
8
+ import { useOverrides } from '../overrides.mjs';
9
+ import { classNames } from '../utils/class-names.mjs';
10
+ import { findLastIndex } from '../utils/find-last-index.mjs';
11
+ import { Comment } from './Comment.mjs';
12
+ import { Composer } from './Composer.mjs';
13
+ import { Button } from './internal/Button.mjs';
14
+ import { Tooltip } from './internal/Tooltip.mjs';
15
+ import { TooltipProvider } from '@radix-ui/react-tooltip';
16
+
17
+ const Thread = forwardRef(
18
+ ({
19
+ thread,
20
+ indentCommentContent = true,
21
+ showActions = "hover",
22
+ showDeletedComments,
23
+ showResolveAction = true,
24
+ showReactions = true,
25
+ showComposer = "collapsed",
26
+ onResolvedChange,
27
+ onCommentEdit,
28
+ onCommentDelete,
29
+ onThreadDelete,
30
+ onAuthorClick,
31
+ onMentionClick,
32
+ overrides,
33
+ className,
34
+ ...props
35
+ }, forwardedRef) => {
36
+ const { useEditThreadMetadata, useThreadSubscription } = useRoomContextBundle();
37
+ const editThreadMetadata = useEditThreadMetadata();
38
+ const $ = useOverrides(overrides);
39
+ const firstCommentIndex = useMemo(() => {
40
+ return showDeletedComments ? 0 : thread.comments.findIndex((comment) => comment.body);
41
+ }, [showDeletedComments, thread.comments]);
42
+ const lastCommentIndex = useMemo(() => {
43
+ return showDeletedComments ? thread.comments.length - 1 : findLastIndex(thread.comments, (comment) => comment.body);
44
+ }, [showDeletedComments, thread.comments]);
45
+ const { status: subscriptionStatus, unreadSince } = useThreadSubscription(
46
+ thread.id
47
+ );
48
+ const unreadIndex = useMemo(() => {
49
+ if (subscriptionStatus !== "subscribed") {
50
+ return;
51
+ }
52
+ if (unreadSince === null) {
53
+ return firstCommentIndex;
54
+ }
55
+ const unreadIndex2 = thread.comments.findIndex(
56
+ (comment) => (showDeletedComments ? true : comment.body) && comment.createdAt > unreadSince
57
+ );
58
+ return unreadIndex2 >= 0 && unreadIndex2 < thread.comments.length ? unreadIndex2 : void 0;
59
+ }, [
60
+ firstCommentIndex,
61
+ showDeletedComments,
62
+ subscriptionStatus,
63
+ thread.comments,
64
+ unreadSince
65
+ ]);
66
+ const [newIndex, setNewIndex] = useState();
67
+ const newIndicatorIndex = newIndex === void 0 ? unreadIndex : newIndex;
68
+ useEffect(() => {
69
+ if (unreadIndex) {
70
+ setNewIndex(
71
+ (persistedUnreadIndex) => Math.min(persistedUnreadIndex ?? Infinity, unreadIndex)
72
+ );
73
+ }
74
+ }, [unreadIndex]);
75
+ const stopPropagation = useCallback((event) => {
76
+ event.stopPropagation();
77
+ }, []);
78
+ const handleResolvedChange = useCallback(
79
+ (resolved) => {
80
+ onResolvedChange?.(resolved);
81
+ editThreadMetadata({ threadId: thread.id, metadata: { resolved } });
82
+ },
83
+ [editThreadMetadata, onResolvedChange, thread.id]
84
+ );
85
+ const handleCommentDelete = useCallback(
86
+ (comment) => {
87
+ onCommentDelete?.(comment);
88
+ const filteredComments = thread.comments.filter(
89
+ (comment2) => comment2.body
90
+ );
91
+ if (filteredComments.length <= 1) {
92
+ onThreadDelete?.(thread);
93
+ }
94
+ },
95
+ [onCommentDelete, onThreadDelete, thread]
96
+ );
97
+ return /* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement("div", {
98
+ className: classNames(
99
+ "lb-root lb-thread",
100
+ showActions === "hover" && "lb-thread:show-actions-hover",
101
+ className
102
+ ),
103
+ "data-resolved": thread.metadata.resolved ? "" : void 0,
104
+ "data-unread": unreadIndex !== void 0 ? "" : void 0,
105
+ dir: $.dir,
106
+ ...props,
107
+ ref: forwardedRef
108
+ }, /* @__PURE__ */ React__default.createElement("div", {
109
+ className: "lb-thread-comments"
110
+ }, thread.comments.map((comment, index) => {
111
+ const isFirstComment = index === firstCommentIndex;
112
+ const isUnread = unreadIndex !== void 0 && index >= unreadIndex;
113
+ const children = /* @__PURE__ */ React__default.createElement(Comment, {
114
+ key: comment.id,
115
+ className: "lb-thread-comment",
116
+ "data-unread": isUnread ? "" : void 0,
117
+ comment,
118
+ indentContent: indentCommentContent,
119
+ showDeleted: showDeletedComments,
120
+ showActions,
121
+ showReactions,
122
+ onCommentEdit,
123
+ onCommentDelete: handleCommentDelete,
124
+ onAuthorClick,
125
+ onMentionClick,
126
+ markThreadAsReadWhenVisible: index === lastCommentIndex && isUnread ? thread.id : void 0,
127
+ additionalActionsClassName: isFirstComment ? "lb-thread-actions" : void 0,
128
+ additionalActions: isFirstComment && showResolveAction ? /* @__PURE__ */ React__default.createElement(Tooltip, {
129
+ content: thread.metadata.resolved ? $.THREAD_UNRESOLVE : $.THREAD_RESOLVE
130
+ }, /* @__PURE__ */ React__default.createElement(TogglePrimitive.Root, {
131
+ pressed: thread.metadata.resolved,
132
+ onPressedChange: handleResolvedChange,
133
+ asChild: true
134
+ }, /* @__PURE__ */ React__default.createElement(Button, {
135
+ className: "lb-comment-action",
136
+ onClick: stopPropagation,
137
+ "aria-label": thread.metadata.resolved ? $.THREAD_UNRESOLVE : $.THREAD_RESOLVE
138
+ }, thread.metadata.resolved ? /* @__PURE__ */ React__default.createElement(ResolvedIcon, {
139
+ className: "lb-button-icon"
140
+ }) : /* @__PURE__ */ React__default.createElement(ResolveIcon, {
141
+ className: "lb-button-icon"
142
+ })))) : null
143
+ });
144
+ return index === newIndicatorIndex && newIndicatorIndex !== firstCommentIndex && newIndicatorIndex <= lastCommentIndex ? /* @__PURE__ */ React__default.createElement(Fragment, {
145
+ key: comment.id
146
+ }, /* @__PURE__ */ React__default.createElement("div", {
147
+ className: "lb-thread-new-indicator",
148
+ "aria-label": $.THREAD_NEW_INDICATOR_DESCRIPTION
149
+ }, /* @__PURE__ */ React__default.createElement("span", {
150
+ className: "lb-thread-new-indicator-label"
151
+ }, /* @__PURE__ */ React__default.createElement(ArrowDownIcon, {
152
+ className: "lb-thread-new-indicator-label-icon"
153
+ }), $.THREAD_NEW_INDICATOR)), children) : children;
154
+ })), showComposer && /* @__PURE__ */ React__default.createElement(Composer, {
155
+ className: "lb-thread-composer",
156
+ threadId: thread.id,
157
+ defaultCollapsed: showComposer === "collapsed" ? true : void 0,
158
+ overrides: {
159
+ COMPOSER_PLACEHOLDER: $.THREAD_COMPOSER_PLACEHOLDER,
160
+ COMPOSER_SEND: $.THREAD_COMPOSER_SEND
161
+ }
162
+ })));
163
+ }
164
+ );
165
+
166
+ export { Thread };
167
+ //# sourceMappingURL=Thread.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Thread.mjs","sources":["../../src/components/Thread.tsx"],"sourcesContent":["\"use client\";\n\nimport type { BaseMetadata, CommentData, ThreadData } from \"@liveblocks/core\";\nimport { useRoomContextBundle } from \"@liveblocks/react\";\nimport * as TogglePrimitive from \"@radix-ui/react-toggle\";\nimport type {\n ComponentPropsWithoutRef,\n ForwardedRef,\n RefAttributes,\n SyntheticEvent,\n} from \"react\";\nimport React, {\n forwardRef,\n Fragment,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\n\nimport { ArrowDownIcon } from \"../icons/ArrowDown\";\nimport { ResolveIcon } from \"../icons/Resolve\";\nimport { ResolvedIcon } from \"../icons/Resolved\";\nimport type {\n CommentOverrides,\n ComposerOverrides,\n GlobalOverrides,\n ThreadOverrides,\n} from \"../overrides\";\nimport { useOverrides } from \"../overrides\";\nimport type { ThreadMetadata } from \"../types\";\nimport { classNames } from \"../utils/class-names\";\nimport { findLastIndex } from \"../utils/find-last-index\";\nimport type { CommentProps } from \"./Comment\";\nimport { Comment } from \"./Comment\";\nimport { Composer } from \"./Composer\";\nimport { Button } from \"./internal/Button\";\nimport { Tooltip, TooltipProvider } from \"./internal/Tooltip\";\n\nexport interface ThreadProps<M extends BaseMetadata = ThreadMetadata>\n extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The thread to display.\n */\n thread: ThreadData<M>;\n\n /**\n * How to show or hide the composer to reply to the thread.\n */\n showComposer?: boolean | \"collapsed\";\n\n /**\n * Whether to show the action to resolve the thread.\n */\n showResolveAction?: boolean;\n\n /**\n * How to show or hide the actions.\n */\n showActions?: CommentProps[\"showActions\"];\n\n /**\n * Whether to show reactions.\n */\n showReactions?: CommentProps[\"showReactions\"];\n\n /**\n * Whether to indent the comments' content.\n */\n indentCommentContent?: CommentProps[\"indentContent\"];\n\n /**\n * Whether to show deleted comments.\n */\n showDeletedComments?: CommentProps[\"showDeleted\"];\n\n /**\n * The event handler called when changing the resolved status.\n */\n onResolvedChange?: (resolved: boolean) => void;\n\n /**\n * The event handler called when a comment is edited.\n */\n onCommentEdit?: CommentProps[\"onCommentEdit\"];\n\n /**\n * The event handler called when a comment is deleted.\n */\n onCommentDelete?: CommentProps[\"onCommentDelete\"];\n\n /**\n * The event handler called when the thread is deleted.\n * A thread is deleted when all its comments are deleted.\n */\n onThreadDelete?: (thread: ThreadData<M>) => void;\n\n /**\n * The event handler called when clicking on a comment's author.\n */\n onAuthorClick?: CommentProps[\"onAuthorClick\"];\n\n /**\n * The event handler called when clicking on a mention.\n */\n onMentionClick?: CommentProps[\"onMentionClick\"];\n\n /**\n * Override the component's strings.\n */\n overrides?: Partial<\n GlobalOverrides & ThreadOverrides & CommentOverrides & ComposerOverrides\n >;\n}\n\n/**\n * Displays a thread of comments, with a composer to reply\n * to it.\n *\n * @example\n * <>\n * {threads.map((thread) => (\n * <Thread key={thread.id} thread={thread} />\n * ))}\n * </>\n */\nexport const Thread = forwardRef(\n <M extends BaseMetadata = ThreadMetadata>(\n {\n thread,\n indentCommentContent = true,\n showActions = \"hover\",\n showDeletedComments,\n showResolveAction = true,\n showReactions = true,\n showComposer = \"collapsed\",\n onResolvedChange,\n onCommentEdit,\n onCommentDelete,\n onThreadDelete,\n onAuthorClick,\n onMentionClick,\n overrides,\n className,\n ...props\n }: ThreadProps<M>,\n forwardedRef: ForwardedRef<HTMLDivElement>\n ) => {\n const { useEditThreadMetadata, useThreadSubscription } =\n useRoomContextBundle();\n const editThreadMetadata = useEditThreadMetadata();\n const $ = useOverrides(overrides);\n const firstCommentIndex = useMemo(() => {\n return showDeletedComments\n ? 0\n : thread.comments.findIndex((comment) => comment.body);\n }, [showDeletedComments, thread.comments]);\n const lastCommentIndex = useMemo(() => {\n return showDeletedComments\n ? thread.comments.length - 1\n : findLastIndex(thread.comments, (comment) => comment.body);\n }, [showDeletedComments, thread.comments]);\n const { status: subscriptionStatus, unreadSince } = useThreadSubscription(\n thread.id\n );\n const unreadIndex = useMemo(() => {\n // The user is not subscribed to this thread.\n if (subscriptionStatus !== \"subscribed\") {\n return;\n }\n\n // The user hasn't read the thread yet, so all comments are unread.\n if (unreadSince === null) {\n return firstCommentIndex;\n }\n\n // The user has read the thread, so we find the first unread comment.\n const unreadIndex = thread.comments.findIndex(\n (comment) =>\n (showDeletedComments ? true : comment.body) &&\n comment.createdAt > unreadSince\n );\n\n return unreadIndex >= 0 && unreadIndex < thread.comments.length\n ? unreadIndex\n : undefined;\n }, [\n firstCommentIndex,\n showDeletedComments,\n subscriptionStatus,\n thread.comments,\n unreadSince,\n ]);\n const [newIndex, setNewIndex] = useState<number>();\n const newIndicatorIndex = newIndex === undefined ? unreadIndex : newIndex;\n\n useEffect(() => {\n if (unreadIndex) {\n // Keep the \"new\" indicator at the lowest unread index.\n setNewIndex((persistedUnreadIndex) =>\n Math.min(persistedUnreadIndex ?? Infinity, unreadIndex)\n );\n }\n }, [unreadIndex]);\n\n const stopPropagation = useCallback((event: SyntheticEvent) => {\n event.stopPropagation();\n }, []);\n\n const handleResolvedChange = useCallback(\n (resolved: boolean) => {\n onResolvedChange?.(resolved);\n\n editThreadMetadata({ threadId: thread.id, metadata: { resolved } });\n },\n [editThreadMetadata, onResolvedChange, thread.id]\n );\n\n const handleCommentDelete = useCallback(\n (comment: CommentData) => {\n onCommentDelete?.(comment);\n\n const filteredComments = thread.comments.filter(\n (comment) => comment.body\n );\n\n if (filteredComments.length <= 1) {\n onThreadDelete?.(thread);\n }\n },\n [onCommentDelete, onThreadDelete, thread]\n );\n\n return (\n <TooltipProvider>\n <div\n className={classNames(\n \"lb-root lb-thread\",\n showActions === \"hover\" && \"lb-thread:show-actions-hover\",\n className\n )}\n data-resolved={\n (thread.metadata as ThreadMetadata).resolved ? \"\" : undefined\n }\n data-unread={unreadIndex !== undefined ? \"\" : undefined}\n dir={$.dir}\n {...props}\n ref={forwardedRef}\n >\n <div className=\"lb-thread-comments\">\n {thread.comments.map((comment, index) => {\n const isFirstComment = index === firstCommentIndex;\n const isUnread =\n unreadIndex !== undefined && index >= unreadIndex;\n\n const children = (\n <Comment\n key={comment.id}\n className=\"lb-thread-comment\"\n data-unread={isUnread ? \"\" : undefined}\n comment={comment}\n indentContent={indentCommentContent}\n showDeleted={showDeletedComments}\n showActions={showActions}\n showReactions={showReactions}\n onCommentEdit={onCommentEdit}\n onCommentDelete={handleCommentDelete}\n onAuthorClick={onAuthorClick}\n onMentionClick={onMentionClick}\n markThreadAsReadWhenVisible={\n index === lastCommentIndex && isUnread\n ? thread.id\n : undefined\n }\n additionalActionsClassName={\n isFirstComment ? \"lb-thread-actions\" : undefined\n }\n additionalActions={\n isFirstComment && showResolveAction ? (\n <Tooltip\n content={\n (thread.metadata as ThreadMetadata).resolved\n ? $.THREAD_UNRESOLVE\n : $.THREAD_RESOLVE\n }\n >\n <TogglePrimitive.Root\n pressed={(thread.metadata as ThreadMetadata).resolved}\n onPressedChange={handleResolvedChange}\n asChild\n >\n <Button\n className=\"lb-comment-action\"\n onClick={stopPropagation}\n aria-label={\n (thread.metadata as ThreadMetadata).resolved\n ? $.THREAD_UNRESOLVE\n : $.THREAD_RESOLVE\n }\n >\n {(thread.metadata as ThreadMetadata).resolved ? (\n <ResolvedIcon className=\"lb-button-icon\" />\n ) : (\n <ResolveIcon className=\"lb-button-icon\" />\n )}\n </Button>\n </TogglePrimitive.Root>\n </Tooltip>\n ) : null\n }\n />\n );\n\n return index === newIndicatorIndex &&\n newIndicatorIndex !== firstCommentIndex &&\n newIndicatorIndex <= lastCommentIndex ? (\n <Fragment key={comment.id}>\n <div\n className=\"lb-thread-new-indicator\"\n aria-label={$.THREAD_NEW_INDICATOR_DESCRIPTION}\n >\n <span className=\"lb-thread-new-indicator-label\">\n <ArrowDownIcon className=\"lb-thread-new-indicator-label-icon\" />\n {$.THREAD_NEW_INDICATOR}\n </span>\n </div>\n {children}\n </Fragment>\n ) : (\n children\n );\n })}\n </div>\n {showComposer && (\n <Composer\n className=\"lb-thread-composer\"\n threadId={thread.id}\n defaultCollapsed={showComposer === \"collapsed\" ? true : undefined}\n overrides={{\n COMPOSER_PLACEHOLDER: $.THREAD_COMPOSER_PLACEHOLDER,\n COMPOSER_SEND: $.THREAD_COMPOSER_SEND,\n }}\n />\n )}\n </div>\n </TooltipProvider>\n );\n }\n) as <M extends BaseMetadata = ThreadMetadata>(\n props: ThreadProps<M> & RefAttributes<HTMLDivElement>\n) => JSX.Element;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA8HO;AAAe;AAElB;AACE;AACuB;AACT;AACd;AACoB;AACJ;AACD;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACG;AAIL;AAEA;AACA;AACA;AACE;AAEuD;AAEzD;AACE;AAE4D;AAE9D;AAAoD;AAC3C;AAET;AAEE;AACE;AAAA;AAIF;AACE;AAAO;AAIT;AAAoC;AAGZ;AAGxB;AAEI;AACH;AACD;AACA;AACA;AACO;AACP;AAEF;AACA;AAEA;AACE;AAEE;AAAA;AACwD;AACxD;AACF;AAGF;AACE;AAAsB;AAGxB;AAA6B;AAEzB;AAEA;AAAkE;AACpE;AACgD;AAGlD;AAA4B;AAExB;AAEA;AAAyC;AAClB;AAGvB;AACE;AAAuB;AACzB;AACF;AACwC;AAG1C;AAEK;AACY;AACT;AAC2B;AAC3B;AACF;AAEsD;AAER;AACvC;AACH;AACC;AAEJ;AAAc;AAEX;AACA;AAGA;AACG;AACc;AACH;AACmB;AAC7B;AACe;AACF;AACb;AACA;AACA;AACiB;AACjB;AACA;AAIM;AAGmC;AAIpC;AAIS;AAGP;AAC8C;AAC5B;AACV;AAEN;AACW;AACD;AAID;AAIL;AAAuB;AAEvB;AAAsB;AAK7B;AAKV;AAGG;AAAsB;AACpB;AACW;AACI;AAEb;AAAe;AACb;AAAwB;AAO/B;AAKH;AACW;AACO;AACuC;AAC7C;AACe;AACP;AACnB;AAIR;AAGN;;"}
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var classNames = require('../../utils/class-names.js');
5
+
6
+ function Attribution({ className, ...props }) {
7
+ return /* @__PURE__ */ React.createElement("a", {
8
+ href: "https://liveblocks.io",
9
+ target: "_blank",
10
+ rel: "noopener noreferrer",
11
+ className: classNames.classNames("lb-composer-attribution", className),
12
+ ...props
13
+ }, /* @__PURE__ */ React.createElement("svg", {
14
+ xmlns: "http://www.w3.org/2000/svg",
15
+ viewBox: "0 0 384 72",
16
+ "aria-label": "Made with Liveblocks"
17
+ }, /* @__PURE__ */ React.createElement("path", {
18
+ fillRule: "evenodd",
19
+ clipRule: "evenodd",
20
+ d: "M86 10h-8v50h8V10Zm16 14h-8v36h8V24Zm0-15h-8v9h8V9Zm13 15h-9l12 36h10l13-36h-9l-9 28-8-28Zm44-1c-11 0-18 8-18 19s7 19 18 19c8 0 15-4 17-13h-8c-1 4-5 6-9 6-6 0-9-3-9-10h27c0-10-6-21-18-21Zm0 7c5 0 9 3 9 8h-18c0-5 4-8 9-8Zm42-7c-4 0-8 2-11 6V10h-8v50h8v-5c3 4 7 6 11 6 11 0 16-9 16-19s-5-19-16-19Zm-2 32c-7 0-9-7-9-13s2-13 9-13 9 7 9 13-2 13-9 13Zm32-45h-8v50h8V10Zm24 51c11 0 18-8 18-19s-8-19-18-19c-11 0-19 8-19 19s7 19 19 19Zm0-6c-8 0-10-7-10-13s2-13 10-13c7 0 9 7 9 13s-2 13-9 13Zm39 6c8 0 15-4 17-12l-8-1c-2 4-4 6-9 6-7 0-9-6-9-12s2-12 9-12c5 0 8 3 8 7l9-1c-2-8-9-13-17-13-11 0-18 9-18 19 0 11 7 19 18 19Zm30-14 4-4 10 17h10l-15-23 15-13h-11l-13 13V10h-9v50h9V47Zm39 14c8 0 16-3 16-12 0-8-8-10-15-11-2-1-7-1-7-5 0-3 3-4 6-4 4 0 7 3 7 7l8-1c-1-9-8-12-15-12s-15 3-15 11 9 10 15 11c3 1 8 2 8 5 0 4-4 5-7 5-5 0-8-3-9-7l-8 1c1 8 9 12 16 12ZM41 27H0l12 12v17l29-29ZM20 60h40L48 48V32L20 60Z",
21
+ fill: "currentColor"
22
+ })));
23
+ }
24
+
25
+ exports.Attribution = Attribution;
26
+ //# sourceMappingURL=Attribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Attribution.js","sources":["../../../src/components/internal/Attribution.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { classNames } from \"../../utils/class-names\";\n\nexport function Attribution({ className, ...props }: ComponentProps<\"a\">) {\n return (\n <a\n href=\"https://liveblocks.io\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={classNames(\"lb-composer-attribution\", className)}\n {...props}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 384 72\"\n aria-label=\"Made with Liveblocks\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M86 10h-8v50h8V10Zm16 14h-8v36h8V24Zm0-15h-8v9h8V9Zm13 15h-9l12 36h10l13-36h-9l-9 28-8-28Zm44-1c-11 0-18 8-18 19s7 19 18 19c8 0 15-4 17-13h-8c-1 4-5 6-9 6-6 0-9-3-9-10h27c0-10-6-21-18-21Zm0 7c5 0 9 3 9 8h-18c0-5 4-8 9-8Zm42-7c-4 0-8 2-11 6V10h-8v50h8v-5c3 4 7 6 11 6 11 0 16-9 16-19s-5-19-16-19Zm-2 32c-7 0-9-7-9-13s2-13 9-13 9 7 9 13-2 13-9 13Zm32-45h-8v50h8V10Zm24 51c11 0 18-8 18-19s-8-19-18-19c-11 0-19 8-19 19s7 19 19 19Zm0-6c-8 0-10-7-10-13s2-13 10-13c7 0 9 7 9 13s-2 13-9 13Zm39 6c8 0 15-4 17-12l-8-1c-2 4-4 6-9 6-7 0-9-6-9-12s2-12 9-12c5 0 8 3 8 7l9-1c-2-8-9-13-17-13-11 0-18 9-18 19 0 11 7 19 18 19Zm30-14 4-4 10 17h10l-15-23 15-13h-11l-13 13V10h-9v50h9V47Zm39 14c8 0 16-3 16-12 0-8-8-10-15-11-2-1-7-1-7-5 0-3 3-4 6-4 4 0 7 3 7 7l8-1c-1-9-8-12-15-12s-15 3-15 11 9 10 15 11c3 1 8 2 8 5 0 4-4 5-7 5-5 0-8-3-9-7l-8 1c1 8 9 12 16 12ZM41 27H0l12 12v17l29-29ZM20 60h40L48 48V32L20 60Z\"\n fill=\"currentColor\"\n />\n </svg>\n </a>\n );\n}\n"],"names":["classNames"],"mappings":";;;;;AAKO,SAAS,WAAY,CAAA,EAAE,SAAc,EAAA,GAAA,KAAA,EAA8B,EAAA;AACxE,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA;AAAA,IACC,IAAK,EAAA,uBAAA;AAAA,IACL,MAAO,EAAA,QAAA;AAAA,IACP,GAAI,EAAA,qBAAA;AAAA,IACJ,SAAA,EAAWA,qBAAW,CAAA,yBAAA,EAA2B,SAAS,CAAA;AAAA,IACzD,GAAG,KAAA;AAAA,GAAA,kBAEH,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,IACC,KAAM,EAAA,4BAAA;AAAA,IACN,OAAQ,EAAA,YAAA;AAAA,IACR,YAAW,EAAA,sBAAA;AAAA,GAAA,kBAEV,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IACC,QAAS,EAAA,SAAA;AAAA,IACT,QAAS,EAAA,SAAA;AAAA,IACT,CAAE,EAAA,y3BAAA;AAAA,IACF,IAAK,EAAA,cAAA;AAAA,GACP,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,24 @@
1
+ import React__default from 'react';
2
+ import { classNames } from '../../utils/class-names.mjs';
3
+
4
+ function Attribution({ className, ...props }) {
5
+ return /* @__PURE__ */ React__default.createElement("a", {
6
+ href: "https://liveblocks.io",
7
+ target: "_blank",
8
+ rel: "noopener noreferrer",
9
+ className: classNames("lb-composer-attribution", className),
10
+ ...props
11
+ }, /* @__PURE__ */ React__default.createElement("svg", {
12
+ xmlns: "http://www.w3.org/2000/svg",
13
+ viewBox: "0 0 384 72",
14
+ "aria-label": "Made with Liveblocks"
15
+ }, /* @__PURE__ */ React__default.createElement("path", {
16
+ fillRule: "evenodd",
17
+ clipRule: "evenodd",
18
+ d: "M86 10h-8v50h8V10Zm16 14h-8v36h8V24Zm0-15h-8v9h8V9Zm13 15h-9l12 36h10l13-36h-9l-9 28-8-28Zm44-1c-11 0-18 8-18 19s7 19 18 19c8 0 15-4 17-13h-8c-1 4-5 6-9 6-6 0-9-3-9-10h27c0-10-6-21-18-21Zm0 7c5 0 9 3 9 8h-18c0-5 4-8 9-8Zm42-7c-4 0-8 2-11 6V10h-8v50h8v-5c3 4 7 6 11 6 11 0 16-9 16-19s-5-19-16-19Zm-2 32c-7 0-9-7-9-13s2-13 9-13 9 7 9 13-2 13-9 13Zm32-45h-8v50h8V10Zm24 51c11 0 18-8 18-19s-8-19-18-19c-11 0-19 8-19 19s7 19 19 19Zm0-6c-8 0-10-7-10-13s2-13 10-13c7 0 9 7 9 13s-2 13-9 13Zm39 6c8 0 15-4 17-12l-8-1c-2 4-4 6-9 6-7 0-9-6-9-12s2-12 9-12c5 0 8 3 8 7l9-1c-2-8-9-13-17-13-11 0-18 9-18 19 0 11 7 19 18 19Zm30-14 4-4 10 17h10l-15-23 15-13h-11l-13 13V10h-9v50h9V47Zm39 14c8 0 16-3 16-12 0-8-8-10-15-11-2-1-7-1-7-5 0-3 3-4 6-4 4 0 7 3 7 7l8-1c-1-9-8-12-15-12s-15 3-15 11 9 10 15 11c3 1 8 2 8 5 0 4-4 5-7 5-5 0-8-3-9-7l-8 1c1 8 9 12 16 12ZM41 27H0l12 12v17l29-29ZM20 60h40L48 48V32L20 60Z",
19
+ fill: "currentColor"
20
+ })));
21
+ }
22
+
23
+ export { Attribution };
24
+ //# sourceMappingURL=Attribution.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Attribution.mjs","sources":["../../../src/components/internal/Attribution.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport React from \"react\";\n\nimport { classNames } from \"../../utils/class-names\";\n\nexport function Attribution({ className, ...props }: ComponentProps<\"a\">) {\n return (\n <a\n href=\"https://liveblocks.io\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={classNames(\"lb-composer-attribution\", className)}\n {...props}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 384 72\"\n aria-label=\"Made with Liveblocks\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M86 10h-8v50h8V10Zm16 14h-8v36h8V24Zm0-15h-8v9h8V9Zm13 15h-9l12 36h10l13-36h-9l-9 28-8-28Zm44-1c-11 0-18 8-18 19s7 19 18 19c8 0 15-4 17-13h-8c-1 4-5 6-9 6-6 0-9-3-9-10h27c0-10-6-21-18-21Zm0 7c5 0 9 3 9 8h-18c0-5 4-8 9-8Zm42-7c-4 0-8 2-11 6V10h-8v50h8v-5c3 4 7 6 11 6 11 0 16-9 16-19s-5-19-16-19Zm-2 32c-7 0-9-7-9-13s2-13 9-13 9 7 9 13-2 13-9 13Zm32-45h-8v50h8V10Zm24 51c11 0 18-8 18-19s-8-19-18-19c-11 0-19 8-19 19s7 19 19 19Zm0-6c-8 0-10-7-10-13s2-13 10-13c7 0 9 7 9 13s-2 13-9 13Zm39 6c8 0 15-4 17-12l-8-1c-2 4-4 6-9 6-7 0-9-6-9-12s2-12 9-12c5 0 8 3 8 7l9-1c-2-8-9-13-17-13-11 0-18 9-18 19 0 11 7 19 18 19Zm30-14 4-4 10 17h10l-15-23 15-13h-11l-13 13V10h-9v50h9V47Zm39 14c8 0 16-3 16-12 0-8-8-10-15-11-2-1-7-1-7-5 0-3 3-4 6-4 4 0 7 3 7 7l8-1c-1-9-8-12-15-12s-15 3-15 11 9 10 15 11c3 1 8 2 8 5 0 4-4 5-7 5-5 0-8-3-9-7l-8 1c1 8 9 12 16 12ZM41 27H0l12 12v17l29-29ZM20 60h40L48 48V32L20 60Z\"\n fill=\"currentColor\"\n />\n </svg>\n </a>\n );\n}\n"],"names":["React"],"mappings":";;;AAKO,SAAS,WAAY,CAAA,EAAE,SAAc,EAAA,GAAA,KAAA,EAA8B,EAAA;AACxE,EAAA,uBACGA,cAAA,CAAA,aAAA,CAAA,GAAA,EAAA;AAAA,IACC,IAAK,EAAA,uBAAA;AAAA,IACL,MAAO,EAAA,QAAA;AAAA,IACP,GAAI,EAAA,qBAAA;AAAA,IACJ,SAAA,EAAW,UAAW,CAAA,yBAAA,EAA2B,SAAS,CAAA;AAAA,IACzD,GAAG,KAAA;AAAA,GAAA,kBAEHA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,IACC,KAAM,EAAA,4BAAA;AAAA,IACN,OAAQ,EAAA,YAAA;AAAA,IACR,YAAW,EAAA,sBAAA;AAAA,GAAA,kBAEVA,cAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IACC,QAAS,EAAA,SAAA;AAAA,IACT,QAAS,EAAA,SAAA;AAAA,IACT,CAAE,EAAA,y3BAAA;AAAA,IACF,IAAK,EAAA,cAAA;AAAA,GACP,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,40 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+ var react = require('@liveblocks/react');
6
+ var classNames = require('../../utils/class-names.js');
7
+ var getInitials = require('../../utils/get-initials.js');
8
+
9
+ function Avatar({ userId, className, ...props }) {
10
+ const { user, isLoading } = react.useUser(userId);
11
+ const resolvedUserName = React.useMemo(() => user?.name, [user]);
12
+ const resolvedUserAvatar = React.useMemo(() => user?.avatar, [user]);
13
+ const resolvedUserInitials = React.useMemo(
14
+ () => resolvedUserName ? getInitials.getInitials(resolvedUserName) : void 0,
15
+ [resolvedUserName]
16
+ );
17
+ const resolvedUserIdInitials = React.useMemo(
18
+ () => !isLoading && !user ? getInitials.getInitials(userId) : void 0,
19
+ [isLoading, user, userId]
20
+ );
21
+ return /* @__PURE__ */ React.createElement("div", {
22
+ className: classNames.classNames("lb-avatar", className),
23
+ "data-loading": isLoading ? "" : void 0,
24
+ ...props
25
+ }, resolvedUserAvatar && /* @__PURE__ */ React.createElement("img", {
26
+ className: "lb-avatar-image",
27
+ src: resolvedUserAvatar,
28
+ alt: resolvedUserName
29
+ }), resolvedUserInitials ? /* @__PURE__ */ React.createElement("span", {
30
+ className: "lb-avatar-fallback",
31
+ "aria-hidden": true
32
+ }, resolvedUserInitials) : resolvedUserIdInitials ? /* @__PURE__ */ React.createElement("span", {
33
+ className: "lb-avatar-fallback",
34
+ "aria-label": userId,
35
+ title: userId
36
+ }, resolvedUserIdInitials) : null);
37
+ }
38
+
39
+ exports.Avatar = Avatar;
40
+ //# sourceMappingURL=Avatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Avatar.js","sources":["../../../src/components/internal/Avatar.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport React, { useMemo } from \"react\";\nimport { useUser } from \"@liveblocks/react\";\n\nimport { classNames } from \"../../utils/class-names\";\nimport { getInitials } from \"../../utils/get-initials\";\n\nexport interface AvatarProps extends ComponentProps<\"div\"> {\n /**\n * The user ID to display the avatar for.\n */\n userId: string;\n}\n\nexport function Avatar({ userId, className, ...props }: AvatarProps) {\n const { user, isLoading } = useUser(userId);\n const resolvedUserName = useMemo(() => user?.name, [user]);\n const resolvedUserAvatar = useMemo(() => user?.avatar, [user]);\n const resolvedUserInitials = useMemo(\n () => (resolvedUserName ? getInitials(resolvedUserName) : undefined),\n [resolvedUserName]\n );\n const resolvedUserIdInitials = useMemo(\n () => (!isLoading && !user ? getInitials(userId) : undefined),\n [isLoading, user, userId]\n );\n\n return (\n <div\n className={classNames(\"lb-avatar\", className)}\n data-loading={isLoading ? \"\" : undefined}\n {...props}\n >\n {resolvedUserAvatar && (\n <img\n className=\"lb-avatar-image\"\n src={resolvedUserAvatar}\n alt={resolvedUserName}\n />\n )}\n {resolvedUserInitials ? (\n <span className=\"lb-avatar-fallback\" aria-hidden>\n {resolvedUserInitials}\n </span>\n ) : resolvedUserIdInitials ? (\n <span className=\"lb-avatar-fallback\" aria-label={userId} title={userId}>\n {resolvedUserIdInitials}\n </span>\n ) : null}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAgBO;AACL;AACA;AACA;AACA;AAA6B;AAC+B;AACzC;AAEnB;AAA+B;AACsB;AAC3B;AAG1B;AACG;AAC6C;AACb;AAC3B;AAGD;AACW;AACL;AACA;AAIN;AAAe;AAAgC;AAI/C;AAAe;AAAiC;AAAe;AAMxE;;"}
@@ -0,0 +1,38 @@
1
+ 'use client';
2
+ import React__default, { useMemo } from 'react';
3
+ import { useUser } from '@liveblocks/react';
4
+ import { classNames } from '../../utils/class-names.mjs';
5
+ import { getInitials } from '../../utils/get-initials.mjs';
6
+
7
+ function Avatar({ userId, className, ...props }) {
8
+ const { user, isLoading } = useUser(userId);
9
+ const resolvedUserName = useMemo(() => user?.name, [user]);
10
+ const resolvedUserAvatar = useMemo(() => user?.avatar, [user]);
11
+ const resolvedUserInitials = useMemo(
12
+ () => resolvedUserName ? getInitials(resolvedUserName) : void 0,
13
+ [resolvedUserName]
14
+ );
15
+ const resolvedUserIdInitials = useMemo(
16
+ () => !isLoading && !user ? getInitials(userId) : void 0,
17
+ [isLoading, user, userId]
18
+ );
19
+ return /* @__PURE__ */ React__default.createElement("div", {
20
+ className: classNames("lb-avatar", className),
21
+ "data-loading": isLoading ? "" : void 0,
22
+ ...props
23
+ }, resolvedUserAvatar && /* @__PURE__ */ React__default.createElement("img", {
24
+ className: "lb-avatar-image",
25
+ src: resolvedUserAvatar,
26
+ alt: resolvedUserName
27
+ }), resolvedUserInitials ? /* @__PURE__ */ React__default.createElement("span", {
28
+ className: "lb-avatar-fallback",
29
+ "aria-hidden": true
30
+ }, resolvedUserInitials) : resolvedUserIdInitials ? /* @__PURE__ */ React__default.createElement("span", {
31
+ className: "lb-avatar-fallback",
32
+ "aria-label": userId,
33
+ title: userId
34
+ }, resolvedUserIdInitials) : null);
35
+ }
36
+
37
+ export { Avatar };
38
+ //# sourceMappingURL=Avatar.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Avatar.mjs","sources":["../../../src/components/internal/Avatar.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport React, { useMemo } from \"react\";\nimport { useUser } from \"@liveblocks/react\";\n\nimport { classNames } from \"../../utils/class-names\";\nimport { getInitials } from \"../../utils/get-initials\";\n\nexport interface AvatarProps extends ComponentProps<\"div\"> {\n /**\n * The user ID to display the avatar for.\n */\n userId: string;\n}\n\nexport function Avatar({ userId, className, ...props }: AvatarProps) {\n const { user, isLoading } = useUser(userId);\n const resolvedUserName = useMemo(() => user?.name, [user]);\n const resolvedUserAvatar = useMemo(() => user?.avatar, [user]);\n const resolvedUserInitials = useMemo(\n () => (resolvedUserName ? getInitials(resolvedUserName) : undefined),\n [resolvedUserName]\n );\n const resolvedUserIdInitials = useMemo(\n () => (!isLoading && !user ? getInitials(userId) : undefined),\n [isLoading, user, userId]\n );\n\n return (\n <div\n className={classNames(\"lb-avatar\", className)}\n data-loading={isLoading ? \"\" : undefined}\n {...props}\n >\n {resolvedUserAvatar && (\n <img\n className=\"lb-avatar-image\"\n src={resolvedUserAvatar}\n alt={resolvedUserName}\n />\n )}\n {resolvedUserInitials ? (\n <span className=\"lb-avatar-fallback\" aria-hidden>\n {resolvedUserInitials}\n </span>\n ) : resolvedUserIdInitials ? (\n <span className=\"lb-avatar-fallback\" aria-label={userId} title={userId}>\n {resolvedUserIdInitials}\n </span>\n ) : null}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;AAgBO;AACL;AACA;AACA;AACA;AAA6B;AAC+B;AACzC;AAEnB;AAA+B;AACsB;AAC3B;AAG1B;AACG;AAC6C;AACb;AAC3B;AAGD;AACW;AACL;AACA;AAIN;AAAe;AAAgC;AAI/C;AAAe;AAAiC;AAAe;AAMxE;;"}
@@ -0,0 +1,24 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+ var classNames = require('../../utils/class-names.js');
6
+
7
+ const Button = React.forwardRef(
8
+ ({ variant = "default", disableable = true, className, ...props }, forwardedRef) => {
9
+ return /* @__PURE__ */ React.createElement("button", {
10
+ type: "button",
11
+ className: classNames.classNames(
12
+ "lb-button",
13
+ !disableable && "lb-button:non-disableable",
14
+ className
15
+ ),
16
+ "data-variant": variant,
17
+ ...props,
18
+ ref: forwardedRef
19
+ });
20
+ }
21
+ );
22
+
23
+ exports.Button = Button;
24
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.js","sources":["../../../src/components/internal/Button.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport React, { forwardRef } from \"react\";\n\nimport { classNames } from \"../../utils/class-names\";\n\nexport interface ButtonProps extends ComponentProps<\"button\"> {\n variant?: \"default\" | \"outline\" | \"primary\";\n disableable?: boolean;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n { variant = \"default\", disableable = true, className, ...props },\n forwardedRef\n ) => {\n return (\n <button\n type=\"button\"\n className={classNames(\n \"lb-button\",\n !disableable && \"lb-button:non-disableable\",\n className\n )}\n data-variant={variant}\n {...props}\n ref={forwardedRef}\n />\n );\n }\n);\n"],"names":[],"mappings":";;;;;;AAYO;AAAe;AAKlB;AACG;AACM;AACM;AACT;AACgB;AAChB;AACF;AACc;AACV;AACC;AACP;AAGN;;"}
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+ import React__default, { forwardRef } from 'react';
3
+ import { classNames } from '../../utils/class-names.mjs';
4
+
5
+ const Button = forwardRef(
6
+ ({ variant = "default", disableable = true, className, ...props }, forwardedRef) => {
7
+ return /* @__PURE__ */ React__default.createElement("button", {
8
+ type: "button",
9
+ className: classNames(
10
+ "lb-button",
11
+ !disableable && "lb-button:non-disableable",
12
+ className
13
+ ),
14
+ "data-variant": variant,
15
+ ...props,
16
+ ref: forwardedRef
17
+ });
18
+ }
19
+ );
20
+
21
+ export { Button };
22
+ //# sourceMappingURL=Button.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.mjs","sources":["../../../src/components/internal/Button.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport React, { forwardRef } from \"react\";\n\nimport { classNames } from \"../../utils/class-names\";\n\nexport interface ButtonProps extends ComponentProps<\"button\"> {\n variant?: \"default\" | \"outline\" | \"primary\";\n disableable?: boolean;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n { variant = \"default\", disableable = true, className, ...props },\n forwardedRef\n ) => {\n return (\n <button\n type=\"button\"\n className={classNames(\n \"lb-button\",\n !disableable && \"lb-button:non-disableable\",\n className\n )}\n data-variant={variant}\n {...props}\n ref={forwardedRef}\n />\n );\n }\n);\n"],"names":[],"mappings":";;;;AAYO;AAAe;AAKlB;AACG;AACM;AACM;AACT;AACgB;AAChB;AACF;AACc;AACV;AACC;AACP;AAGN;;"}
@@ -0,0 +1,72 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
5
+ var React = require('react');
6
+ var config = require('../../config.js');
7
+ var constants = require('../../constants.js');
8
+ var overrides = require('../../overrides.js');
9
+ var classNames = require('../../utils/class-names.js');
10
+
11
+ function _interopNamespaceDefault(e) {
12
+ var n = Object.create(null);
13
+ if (e) {
14
+ Object.keys(e).forEach(function (k) {
15
+ if (k !== 'default') {
16
+ var d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: function () { return e[k]; }
20
+ });
21
+ }
22
+ });
23
+ }
24
+ n.default = e;
25
+ return Object.freeze(n);
26
+ }
27
+
28
+ var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DropdownMenuPrimitive);
29
+
30
+ function Dropdown({
31
+ children,
32
+ content,
33
+ defaultOpen,
34
+ open,
35
+ onOpenChange,
36
+ className,
37
+ ...props
38
+ }) {
39
+ const $ = overrides.useOverrides();
40
+ const { portalContainer } = config.useLiveblocksUIConfig();
41
+ return /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Root, {
42
+ defaultOpen,
43
+ open,
44
+ onOpenChange,
45
+ dir: $.dir
46
+ }, children, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Portal, {
47
+ container: portalContainer
48
+ }, /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.Content, {
49
+ className: classNames.classNames(
50
+ "lb-root lb-portal lb-elevation lb-dropdown",
51
+ className
52
+ ),
53
+ sideOffset: constants.FLOATING_ELEMENT_SIDE_OFFSET,
54
+ collisionPadding: constants.FLOATING_ELEMENT_COLLISION_PADDING,
55
+ ...props
56
+ }, content)));
57
+ }
58
+ const DropdownItem = React.forwardRef(({ children, className, ...props }, forwardedRef) => {
59
+ return /* @__PURE__ */ React.createElement(DropdownMenuPrimitive__namespace.DropdownMenuItem, {
60
+ className: classNames.classNames("lb-dropdown-item", className),
61
+ ...props,
62
+ ref: forwardedRef
63
+ }, children);
64
+ });
65
+
66
+ Object.defineProperty(exports, 'DropdownTrigger', {
67
+ enumerable: true,
68
+ get: function () { return DropdownMenuPrimitive.DropdownMenuTrigger; }
69
+ });
70
+ exports.Dropdown = Dropdown;
71
+ exports.DropdownItem = DropdownItem;
72
+ //# sourceMappingURL=Dropdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropdown.js","sources":["../../../src/components/internal/Dropdown.tsx"],"sourcesContent":["\"use client\";\n\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport type { ReactNode } from \"react\";\nimport React, { forwardRef } from \"react\";\n\nimport { useLiveblocksUIConfig } from \"../../config\";\nimport {\n FLOATING_ELEMENT_COLLISION_PADDING,\n FLOATING_ELEMENT_SIDE_OFFSET,\n} from \"../../constants\";\nimport { useOverrides } from \"../../overrides\";\nimport { classNames } from \"../../utils/class-names\";\n\nexport interface DropdownProps\n extends Pick<\n DropdownMenuPrimitive.DropdownMenuProps,\n \"defaultOpen\" | \"open\" | \"onOpenChange\"\n >,\n Pick<DropdownMenuPrimitive.DropdownMenuTriggerProps, \"children\">,\n Omit<DropdownMenuPrimitive.DropdownMenuContentProps, \"content\"> {\n content: ReactNode;\n}\n\nexport function Dropdown({\n children,\n content,\n defaultOpen,\n open,\n onOpenChange,\n className,\n ...props\n}: DropdownProps) {\n const $ = useOverrides();\n const { portalContainer } = useLiveblocksUIConfig();\n\n return (\n <DropdownMenuPrimitive.Root\n defaultOpen={defaultOpen}\n open={open}\n onOpenChange={onOpenChange}\n dir={$.dir}\n >\n {children}\n <DropdownMenuPrimitive.Portal container={portalContainer}>\n <DropdownMenuPrimitive.Content\n className={classNames(\n \"lb-root lb-portal lb-elevation lb-dropdown\",\n className\n )}\n sideOffset={FLOATING_ELEMENT_SIDE_OFFSET}\n collisionPadding={FLOATING_ELEMENT_COLLISION_PADDING}\n {...props}\n >\n {content}\n </DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>\n </DropdownMenuPrimitive.Root>\n );\n}\n\nexport const DropdownItem = forwardRef<\n HTMLDivElement,\n DropdownMenuPrimitive.DropdownMenuItemProps\n>(({ children, className, ...props }, forwardedRef) => {\n return (\n <DropdownMenuPrimitive.DropdownMenuItem\n className={classNames(\"lb-dropdown-item\", className)}\n {...props}\n ref={forwardedRef}\n >\n {children}\n </DropdownMenuPrimitive.DropdownMenuItem>\n );\n});\n\nexport { DropdownMenuTrigger as DropdownTrigger } from \"@radix-ui/react-dropdown-menu\";\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO;AAAkB;AACvB;AACA;AACA;AACA;AACA;AACA;AAEF;AACE;AACA;AAEA;AACG;AACC;AACA;AACA;AACO;AAGN;AAAwC;AACtC;AACY;AACT;AACA;AACF;AACY;AACM;AACd;AAOd;AAEa;AAIX;AACG;AACoD;AAC/C;AACC;AAKX;;;;;;;"}
@@ -0,0 +1,47 @@
1
+ 'use client';
2
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
3
+ export { DropdownMenuTrigger as DropdownTrigger } from '@radix-ui/react-dropdown-menu';
4
+ import React__default, { forwardRef } from 'react';
5
+ import { useLiveblocksUIConfig } from '../../config.mjs';
6
+ import { FLOATING_ELEMENT_SIDE_OFFSET, FLOATING_ELEMENT_COLLISION_PADDING } from '../../constants.mjs';
7
+ import { useOverrides } from '../../overrides.mjs';
8
+ import { classNames } from '../../utils/class-names.mjs';
9
+
10
+ function Dropdown({
11
+ children,
12
+ content,
13
+ defaultOpen,
14
+ open,
15
+ onOpenChange,
16
+ className,
17
+ ...props
18
+ }) {
19
+ const $ = useOverrides();
20
+ const { portalContainer } = useLiveblocksUIConfig();
21
+ return /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.Root, {
22
+ defaultOpen,
23
+ open,
24
+ onOpenChange,
25
+ dir: $.dir
26
+ }, children, /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.Portal, {
27
+ container: portalContainer
28
+ }, /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.Content, {
29
+ className: classNames(
30
+ "lb-root lb-portal lb-elevation lb-dropdown",
31
+ className
32
+ ),
33
+ sideOffset: FLOATING_ELEMENT_SIDE_OFFSET,
34
+ collisionPadding: FLOATING_ELEMENT_COLLISION_PADDING,
35
+ ...props
36
+ }, content)));
37
+ }
38
+ const DropdownItem = forwardRef(({ children, className, ...props }, forwardedRef) => {
39
+ return /* @__PURE__ */ React__default.createElement(DropdownMenuPrimitive.DropdownMenuItem, {
40
+ className: classNames("lb-dropdown-item", className),
41
+ ...props,
42
+ ref: forwardedRef
43
+ }, children);
44
+ });
45
+
46
+ export { Dropdown, DropdownItem };
47
+ //# sourceMappingURL=Dropdown.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropdown.mjs","sources":["../../../src/components/internal/Dropdown.tsx"],"sourcesContent":["\"use client\";\n\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport type { ReactNode } from \"react\";\nimport React, { forwardRef } from \"react\";\n\nimport { useLiveblocksUIConfig } from \"../../config\";\nimport {\n FLOATING_ELEMENT_COLLISION_PADDING,\n FLOATING_ELEMENT_SIDE_OFFSET,\n} from \"../../constants\";\nimport { useOverrides } from \"../../overrides\";\nimport { classNames } from \"../../utils/class-names\";\n\nexport interface DropdownProps\n extends Pick<\n DropdownMenuPrimitive.DropdownMenuProps,\n \"defaultOpen\" | \"open\" | \"onOpenChange\"\n >,\n Pick<DropdownMenuPrimitive.DropdownMenuTriggerProps, \"children\">,\n Omit<DropdownMenuPrimitive.DropdownMenuContentProps, \"content\"> {\n content: ReactNode;\n}\n\nexport function Dropdown({\n children,\n content,\n defaultOpen,\n open,\n onOpenChange,\n className,\n ...props\n}: DropdownProps) {\n const $ = useOverrides();\n const { portalContainer } = useLiveblocksUIConfig();\n\n return (\n <DropdownMenuPrimitive.Root\n defaultOpen={defaultOpen}\n open={open}\n onOpenChange={onOpenChange}\n dir={$.dir}\n >\n {children}\n <DropdownMenuPrimitive.Portal container={portalContainer}>\n <DropdownMenuPrimitive.Content\n className={classNames(\n \"lb-root lb-portal lb-elevation lb-dropdown\",\n className\n )}\n sideOffset={FLOATING_ELEMENT_SIDE_OFFSET}\n collisionPadding={FLOATING_ELEMENT_COLLISION_PADDING}\n {...props}\n >\n {content}\n </DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>\n </DropdownMenuPrimitive.Root>\n );\n}\n\nexport const DropdownItem = forwardRef<\n HTMLDivElement,\n DropdownMenuPrimitive.DropdownMenuItemProps\n>(({ children, className, ...props }, forwardedRef) => {\n return (\n <DropdownMenuPrimitive.DropdownMenuItem\n className={classNames(\"lb-dropdown-item\", className)}\n {...props}\n ref={forwardedRef}\n >\n {children}\n </DropdownMenuPrimitive.DropdownMenuItem>\n );\n});\n\nexport { DropdownMenuTrigger as DropdownTrigger } from \"@radix-ui/react-dropdown-menu\";\n"],"names":[],"mappings":";;;;;;;;;AAwBO;AAAkB;AACvB;AACA;AACA;AACA;AACA;AACA;AAEF;AACE;AACA;AAEA;AACG;AACC;AACA;AACA;AACO;AAGN;AAAwC;AACtC;AACY;AACT;AACA;AACF;AACY;AACM;AACd;AAOd;AAEa;AAIX;AACG;AACoD;AAC/C;AACC;AAKX;;"}
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var Emoji$1 = require('../../primitives/internal/Emoji.js');
5
+ var classNames = require('../../utils/class-names.js');
6
+
7
+ const Emoji = React.forwardRef(
8
+ ({ className, ...props }, forwardedRef) => {
9
+ return /* @__PURE__ */ React.createElement(Emoji$1.Emoji, {
10
+ className: classNames.classNames("lb-emoji", className),
11
+ ...props,
12
+ ref: forwardedRef
13
+ });
14
+ }
15
+ );
16
+
17
+ exports.Emoji = Emoji;
18
+ //# sourceMappingURL=Emoji.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Emoji.js","sources":["../../../src/components/internal/Emoji.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\n\nimport type { EmojiProps as EmojiPrimitiveProps } from \"../../primitives/internal/Emoji\";\nimport { Emoji as EmojiPrimitive } from \"../../primitives/internal/Emoji\";\nimport { classNames } from \"../../utils/class-names\";\n\nexport const Emoji = forwardRef<HTMLSpanElement, EmojiPrimitiveProps>(\n ({ className, ...props }, forwardedRef) => {\n return (\n <EmojiPrimitive\n className={classNames(\"lb-emoji\", className)}\n {...props}\n ref={forwardedRef}\n />\n );\n }\n);\n"],"names":["forwardRef","EmojiPrimitive","classNames"],"mappings":";;;;;;AAMO,MAAM,KAAQ,GAAAA,gBAAA;AAAA,EACnB,CAAC,EAAE,SAAc,EAAA,GAAA,KAAA,IAAS,YAAiB,KAAA;AACzC,IAAA,uBACG,KAAA,CAAA,aAAA,CAAAC,aAAA,EAAA;AAAA,MACC,SAAA,EAAWC,qBAAW,CAAA,UAAA,EAAY,SAAS,CAAA;AAAA,MAC1C,GAAG,KAAA;AAAA,MACJ,GAAK,EAAA,YAAA;AAAA,KACP,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
@@ -0,0 +1,16 @@
1
+ import React__default, { forwardRef } from 'react';
2
+ import { Emoji as Emoji$1 } from '../../primitives/internal/Emoji.mjs';
3
+ import { classNames } from '../../utils/class-names.mjs';
4
+
5
+ const Emoji = forwardRef(
6
+ ({ className, ...props }, forwardedRef) => {
7
+ return /* @__PURE__ */ React__default.createElement(Emoji$1, {
8
+ className: classNames("lb-emoji", className),
9
+ ...props,
10
+ ref: forwardedRef
11
+ });
12
+ }
13
+ );
14
+
15
+ export { Emoji };
16
+ //# sourceMappingURL=Emoji.mjs.map