@liveblocks/react-ui 2.14.0 → 2.15.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 (272) hide show
  1. package/dist/_private/index.d.mts +24 -22
  2. package/dist/_private/index.d.ts +24 -22
  3. package/dist/_private/index.js +1 -0
  4. package/dist/_private/index.js.map +1 -1
  5. package/dist/_private/index.mjs +1 -0
  6. package/dist/_private/index.mjs.map +1 -1
  7. package/dist/components/Comment.js +358 -256
  8. package/dist/components/Comment.js.map +1 -1
  9. package/dist/components/Comment.mjs +334 -232
  10. package/dist/components/Comment.mjs.map +1 -1
  11. package/dist/components/Composer.js +308 -225
  12. package/dist/components/Composer.js.map +1 -1
  13. package/dist/components/Composer.mjs +288 -206
  14. package/dist/components/Composer.mjs.map +1 -1
  15. package/dist/components/HistoryVersionSummary.js +28 -32
  16. package/dist/components/HistoryVersionSummary.js.map +1 -1
  17. package/dist/components/HistoryVersionSummary.mjs +27 -31
  18. package/dist/components/HistoryVersionSummary.mjs.map +1 -1
  19. package/dist/components/HistoryVersionSummaryList.js +11 -9
  20. package/dist/components/HistoryVersionSummaryList.js.map +1 -1
  21. package/dist/components/HistoryVersionSummaryList.mjs +10 -8
  22. package/dist/components/HistoryVersionSummaryList.mjs.map +1 -1
  23. package/dist/components/InboxNotification.js +202 -143
  24. package/dist/components/InboxNotification.js.map +1 -1
  25. package/dist/components/InboxNotification.mjs +180 -121
  26. package/dist/components/InboxNotification.mjs.map +1 -1
  27. package/dist/components/InboxNotificationList.js +19 -14
  28. package/dist/components/InboxNotificationList.js.map +1 -1
  29. package/dist/components/InboxNotificationList.mjs +17 -12
  30. package/dist/components/InboxNotificationList.mjs.map +1 -1
  31. package/dist/components/Thread.js +104 -86
  32. package/dist/components/Thread.js.map +1 -1
  33. package/dist/components/Thread.mjs +93 -75
  34. package/dist/components/Thread.mjs.map +1 -1
  35. package/dist/components/internal/Attachment.js +161 -113
  36. package/dist/components/internal/Attachment.js.map +1 -1
  37. package/dist/components/internal/Attachment.mjs +150 -102
  38. package/dist/components/internal/Attachment.mjs.map +1 -1
  39. package/dist/components/internal/Attribution.js +15 -13
  40. package/dist/components/internal/Attribution.js.map +1 -1
  41. package/dist/components/internal/Attribution.mjs +15 -13
  42. package/dist/components/internal/Attribution.mjs.map +1 -1
  43. package/dist/components/internal/Avatar.js +27 -20
  44. package/dist/components/internal/Avatar.js.map +1 -1
  45. package/dist/components/internal/Avatar.mjs +23 -16
  46. package/dist/components/internal/Avatar.mjs.map +1 -1
  47. package/dist/components/internal/Button.js +5 -4
  48. package/dist/components/internal/Button.js.map +1 -1
  49. package/dist/components/internal/Button.mjs +4 -3
  50. package/dist/components/internal/Button.mjs.map +1 -1
  51. package/dist/components/internal/Dropdown.js +27 -19
  52. package/dist/components/internal/Dropdown.js.map +1 -1
  53. package/dist/components/internal/Dropdown.mjs +26 -18
  54. package/dist/components/internal/Dropdown.mjs.map +1 -1
  55. package/dist/components/internal/Emoji.js +4 -3
  56. package/dist/components/internal/Emoji.js.map +1 -1
  57. package/dist/components/internal/Emoji.mjs +3 -2
  58. package/dist/components/internal/Emoji.mjs.map +1 -1
  59. package/dist/components/internal/EmojiPicker.js +96 -72
  60. package/dist/components/internal/EmojiPicker.js.map +1 -1
  61. package/dist/components/internal/EmojiPicker.mjs +90 -66
  62. package/dist/components/internal/EmojiPicker.mjs.map +1 -1
  63. package/dist/components/internal/Icon.js +5 -4
  64. package/dist/components/internal/Icon.js.map +1 -1
  65. package/dist/components/internal/Icon.mjs +5 -4
  66. package/dist/components/internal/Icon.mjs.map +1 -1
  67. package/dist/components/internal/InboxNotificationThread.js +53 -38
  68. package/dist/components/internal/InboxNotificationThread.js.map +1 -1
  69. package/dist/components/internal/InboxNotificationThread.mjs +53 -38
  70. package/dist/components/internal/InboxNotificationThread.mjs.map +1 -1
  71. package/dist/components/internal/List.js +8 -6
  72. package/dist/components/internal/List.js.map +1 -1
  73. package/dist/components/internal/List.mjs +6 -4
  74. package/dist/components/internal/List.mjs.map +1 -1
  75. package/dist/components/internal/Room.js +8 -6
  76. package/dist/components/internal/Room.js.map +1 -1
  77. package/dist/components/internal/Room.mjs +7 -5
  78. package/dist/components/internal/Room.mjs.map +1 -1
  79. package/dist/components/internal/Tooltip.js +49 -33
  80. package/dist/components/internal/Tooltip.js.map +1 -1
  81. package/dist/components/internal/Tooltip.mjs +46 -30
  82. package/dist/components/internal/Tooltip.mjs.map +1 -1
  83. package/dist/components/internal/User.js +8 -6
  84. package/dist/components/internal/User.js.map +1 -1
  85. package/dist/components/internal/User.mjs +7 -5
  86. package/dist/components/internal/User.mjs.map +1 -1
  87. package/dist/components.js +12 -29
  88. package/dist/components.js.map +1 -1
  89. package/dist/components.mjs +6 -5
  90. package/dist/components.mjs.map +1 -1
  91. package/dist/config.js +16 -12
  92. package/dist/config.js.map +1 -1
  93. package/dist/config.mjs +13 -9
  94. package/dist/config.mjs.map +1 -1
  95. package/dist/icons/ArrowDown.js +7 -6
  96. package/dist/icons/ArrowDown.js.map +1 -1
  97. package/dist/icons/ArrowDown.mjs +7 -6
  98. package/dist/icons/ArrowDown.mjs.map +1 -1
  99. package/dist/icons/ArrowUp.js +7 -6
  100. package/dist/icons/ArrowUp.js.map +1 -1
  101. package/dist/icons/ArrowUp.mjs +7 -6
  102. package/dist/icons/ArrowUp.mjs.map +1 -1
  103. package/dist/icons/Attachment.js +7 -6
  104. package/dist/icons/Attachment.js.map +1 -1
  105. package/dist/icons/Attachment.mjs +7 -6
  106. package/dist/icons/Attachment.mjs.map +1 -1
  107. package/dist/icons/Bold.js +7 -6
  108. package/dist/icons/Bold.js.map +1 -1
  109. package/dist/icons/Bold.mjs +7 -6
  110. package/dist/icons/Bold.mjs.map +1 -1
  111. package/dist/icons/Check.js +7 -6
  112. package/dist/icons/Check.js.map +1 -1
  113. package/dist/icons/Check.mjs +7 -6
  114. package/dist/icons/Check.mjs.map +1 -1
  115. package/dist/icons/Code.js +7 -6
  116. package/dist/icons/Code.js.map +1 -1
  117. package/dist/icons/Code.mjs +7 -6
  118. package/dist/icons/Code.mjs.map +1 -1
  119. package/dist/icons/Cross.js +12 -8
  120. package/dist/icons/Cross.js.map +1 -1
  121. package/dist/icons/Cross.mjs +12 -8
  122. package/dist/icons/Cross.mjs.map +1 -1
  123. package/dist/icons/Delete.js +7 -6
  124. package/dist/icons/Delete.js.map +1 -1
  125. package/dist/icons/Delete.mjs +7 -6
  126. package/dist/icons/Delete.mjs.map +1 -1
  127. package/dist/icons/Edit.js +7 -6
  128. package/dist/icons/Edit.js.map +1 -1
  129. package/dist/icons/Edit.mjs +7 -6
  130. package/dist/icons/Edit.mjs.map +1 -1
  131. package/dist/icons/Ellipsis.js +21 -16
  132. package/dist/icons/Ellipsis.js.map +1 -1
  133. package/dist/icons/Ellipsis.mjs +21 -16
  134. package/dist/icons/Ellipsis.mjs.map +1 -1
  135. package/dist/icons/Emoji.js +25 -18
  136. package/dist/icons/Emoji.js.map +1 -1
  137. package/dist/icons/Emoji.mjs +25 -18
  138. package/dist/icons/Emoji.mjs.map +1 -1
  139. package/dist/icons/EmojiAdd.js +28 -20
  140. package/dist/icons/EmojiAdd.js.map +1 -1
  141. package/dist/icons/EmojiAdd.mjs +28 -20
  142. package/dist/icons/EmojiAdd.mjs.map +1 -1
  143. package/dist/icons/Italic.js +7 -6
  144. package/dist/icons/Italic.js.map +1 -1
  145. package/dist/icons/Italic.mjs +7 -6
  146. package/dist/icons/Italic.mjs.map +1 -1
  147. package/dist/icons/Mention.js +12 -8
  148. package/dist/icons/Mention.js.map +1 -1
  149. package/dist/icons/Mention.mjs +12 -8
  150. package/dist/icons/Mention.mjs.map +1 -1
  151. package/dist/icons/Resolve.js +14 -10
  152. package/dist/icons/Resolve.js.map +1 -1
  153. package/dist/icons/Resolve.mjs +14 -10
  154. package/dist/icons/Resolve.mjs.map +1 -1
  155. package/dist/icons/Resolved.js +16 -12
  156. package/dist/icons/Resolved.js.map +1 -1
  157. package/dist/icons/Resolved.mjs +16 -12
  158. package/dist/icons/Resolved.mjs.map +1 -1
  159. package/dist/icons/Restore.js +12 -8
  160. package/dist/icons/Restore.js.map +1 -1
  161. package/dist/icons/Restore.mjs +12 -8
  162. package/dist/icons/Restore.mjs.map +1 -1
  163. package/dist/icons/Search.js +7 -6
  164. package/dist/icons/Search.js.map +1 -1
  165. package/dist/icons/Search.mjs +7 -6
  166. package/dist/icons/Search.mjs.map +1 -1
  167. package/dist/icons/Send.js +7 -6
  168. package/dist/icons/Send.js.map +1 -1
  169. package/dist/icons/Send.mjs +7 -6
  170. package/dist/icons/Send.mjs.map +1 -1
  171. package/dist/icons/Spinner.js +8 -7
  172. package/dist/icons/Spinner.js.map +1 -1
  173. package/dist/icons/Spinner.mjs +8 -7
  174. package/dist/icons/Spinner.mjs.map +1 -1
  175. package/dist/icons/Strikethrough.js +7 -6
  176. package/dist/icons/Strikethrough.js.map +1 -1
  177. package/dist/icons/Strikethrough.mjs +7 -6
  178. package/dist/icons/Strikethrough.mjs.map +1 -1
  179. package/dist/icons/Warning.js +14 -10
  180. package/dist/icons/Warning.js.map +1 -1
  181. package/dist/icons/Warning.mjs +14 -10
  182. package/dist/icons/Warning.mjs.map +1 -1
  183. package/dist/icons/index.js +42 -0
  184. package/dist/icons/index.js.map +1 -0
  185. package/dist/icons/index.mjs +19 -0
  186. package/dist/icons/index.mjs.map +1 -0
  187. package/dist/index.d.mts +14 -12
  188. package/dist/index.d.ts +14 -12
  189. package/dist/overrides.js +65 -36
  190. package/dist/overrides.js.map +1 -1
  191. package/dist/overrides.mjs +59 -12
  192. package/dist/overrides.mjs.map +1 -1
  193. package/dist/primitives/Comment/index.js +75 -66
  194. package/dist/primitives/Comment/index.js.map +1 -1
  195. package/dist/primitives/Comment/index.mjs +71 -62
  196. package/dist/primitives/Comment/index.mjs.map +1 -1
  197. package/dist/primitives/Composer/contexts.js +11 -11
  198. package/dist/primitives/Composer/index.js +343 -284
  199. package/dist/primitives/Composer/index.js.map +1 -1
  200. package/dist/primitives/Composer/index.mjs +262 -203
  201. package/dist/primitives/Composer/index.mjs.map +1 -1
  202. package/dist/primitives/Composer/utils.js +20 -21
  203. package/dist/primitives/Composer/utils.js.map +1 -1
  204. package/dist/primitives/Composer/utils.mjs +4 -5
  205. package/dist/primitives/Composer/utils.mjs.map +1 -1
  206. package/dist/primitives/EmojiPicker/contexts.js +3 -3
  207. package/dist/primitives/EmojiPicker/index.js +160 -142
  208. package/dist/primitives/EmojiPicker/index.js.map +1 -1
  209. package/dist/primitives/EmojiPicker/index.mjs +122 -104
  210. package/dist/primitives/EmojiPicker/index.mjs.map +1 -1
  211. package/dist/primitives/FileSize.js +9 -7
  212. package/dist/primitives/FileSize.js.map +1 -1
  213. package/dist/primitives/FileSize.mjs +7 -5
  214. package/dist/primitives/FileSize.mjs.map +1 -1
  215. package/dist/primitives/Timestamp.js +12 -10
  216. package/dist/primitives/Timestamp.js.map +1 -1
  217. package/dist/primitives/Timestamp.mjs +7 -5
  218. package/dist/primitives/Timestamp.mjs.map +1 -1
  219. package/dist/primitives/index.d.mts +24 -23
  220. package/dist/primitives/index.d.ts +24 -23
  221. package/dist/primitives/internal/Emoji.js +7 -5
  222. package/dist/primitives/internal/Emoji.js.map +1 -1
  223. package/dist/primitives/internal/Emoji.mjs +6 -4
  224. package/dist/primitives/internal/Emoji.mjs.map +1 -1
  225. package/dist/shared.js +2 -7
  226. package/dist/shared.js.map +1 -1
  227. package/dist/shared.mjs +2 -7
  228. package/dist/shared.mjs.map +1 -1
  229. package/dist/slate/plugins/auto-links.mjs +1 -1
  230. package/dist/slate/plugins/custom-links.mjs +1 -1
  231. package/dist/slate/plugins/mentions.mjs +1 -1
  232. package/dist/utils/Persist.js +19 -18
  233. package/dist/utils/Persist.js.map +1 -1
  234. package/dist/utils/Persist.mjs +7 -6
  235. package/dist/utils/Persist.mjs.map +1 -1
  236. package/dist/utils/Portal.js +5 -4
  237. package/dist/utils/Portal.js.map +1 -1
  238. package/dist/utils/Portal.mjs +4 -3
  239. package/dist/utils/Portal.mjs.map +1 -1
  240. package/dist/utils/use-controllable-state.js +5 -5
  241. package/dist/utils/use-index.js +7 -7
  242. package/dist/utils/use-initial.js +2 -2
  243. package/dist/utils/use-interval.js +4 -4
  244. package/dist/utils/use-latest.js +3 -3
  245. package/dist/utils/use-observable.js +2 -2
  246. package/dist/utils/use-refs.js +2 -2
  247. package/dist/utils/use-rerender.js +2 -2
  248. package/dist/utils/use-visible.js +24 -2
  249. package/dist/utils/use-visible.js.map +1 -1
  250. package/dist/utils/use-visible.mjs +23 -2
  251. package/dist/utils/use-visible.mjs.map +1 -1
  252. package/dist/utils/use-window-focus.js +2 -2
  253. package/dist/utils/use-window-focus.js.map +1 -1
  254. package/dist/utils/use-window-focus.mjs +1 -1
  255. package/dist/utils/use-window-focus.mjs.map +1 -1
  256. package/dist/version.js +2 -2
  257. package/dist/version.js.map +1 -1
  258. package/dist/version.mjs +2 -2
  259. package/dist/version.mjs.map +1 -1
  260. package/package.json +10 -25
  261. package/dist/utils/use-id.js +0 -29
  262. package/dist/utils/use-id.js.map +0 -1
  263. package/dist/utils/use-id.mjs +0 -27
  264. package/dist/utils/use-id.mjs.map +0 -1
  265. package/dist/utils/use-layout-effect.js +0 -8
  266. package/dist/utils/use-layout-effect.js.map +0 -1
  267. package/dist/utils/use-layout-effect.mjs +0 -6
  268. package/dist/utils/use-layout-effect.mjs.map +0 -1
  269. package/dist/utils/use-transition.js +0 -16
  270. package/dist/utils/use-transition.js.map +0 -1
  271. package/dist/utils/use-transition.mjs +0 -14
  272. package/dist/utils/use-transition.mjs.map +0 -1
@@ -1,11 +1,11 @@
1
- 'use client';
2
1
  'use strict';
3
2
 
3
+ var jsxRuntime = require('react/jsx-runtime');
4
4
  var core = require('@liveblocks/core');
5
5
  var _private = require('@liveblocks/react/_private');
6
6
  var reactSlot = require('@radix-ui/react-slot');
7
7
  var TogglePrimitive = require('@radix-ui/react-toggle');
8
- var React = require('react');
8
+ var react = require('react');
9
9
  var slate = require('slate');
10
10
  var slateHistory = require('slate-history');
11
11
  var slateReact = require('slate-react');
@@ -24,15 +24,13 @@ var isKey = require('../../utils/is-key.js');
24
24
  var Persist = require('../../utils/Persist.js');
25
25
  var Portal = require('../../utils/Portal.js');
26
26
  var requestSubmit = require('../../utils/request-submit.js');
27
- var useId = require('../../utils/use-id.js');
28
27
  var useIndex = require('../../utils/use-index.js');
29
28
  var useInitial = require('../../utils/use-initial.js');
30
- var useLayoutEffect = require('../../utils/use-layout-effect.js');
31
29
  var useObservable = require('../../utils/use-observable.js');
32
30
  var useRefs = require('../../utils/use-refs.js');
33
- var utils$1 = require('../Comment/utils.js');
31
+ var utils = require('../Comment/utils.js');
34
32
  var contexts = require('./contexts.js');
35
- var utils = require('./utils.js');
33
+ var utils$1 = require('./utils.js');
36
34
 
37
35
  function _interopNamespaceDefault(e) {
38
36
  var n = Object.create(null);
@@ -53,6 +51,7 @@ function _interopNamespaceDefault(e) {
53
51
 
54
52
  var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(TogglePrimitive);
55
53
 
54
+ "use client";
56
55
  const MENTION_SUGGESTIONS_POSITION = "top";
57
56
  const FLOATING_TOOLBAR_POSITION = "top";
58
57
  const COMPOSER_MENTION_NAME = "ComposerMention";
@@ -99,12 +98,16 @@ function ComposerEditorMentionWrapper({
99
98
  element
100
99
  }) {
101
100
  const isSelected = slateReact.useSelected();
102
- return /* @__PURE__ */ React.createElement("span", {
103
- ...attributes
104
- }, element.id ? /* @__PURE__ */ React.createElement(Mention, {
105
- userId: element.id,
106
- isSelected
107
- }) : null, children);
101
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", {
102
+ ...attributes,
103
+ children: [
104
+ element.id ? /* @__PURE__ */ jsxRuntime.jsx(Mention, {
105
+ userId: element.id,
106
+ isSelected
107
+ }) : null,
108
+ children
109
+ ]
110
+ });
108
111
  }
109
112
  function ComposerEditorLinkWrapper({
110
113
  Link,
@@ -112,15 +115,17 @@ function ComposerEditorLinkWrapper({
112
115
  element,
113
116
  children
114
117
  }) {
115
- const href = React.useMemo(
116
- () => utils$1.toAbsoluteUrl(element.url) ?? element.url,
118
+ const href = react.useMemo(
119
+ () => utils.toAbsoluteUrl(element.url) ?? element.url,
117
120
  [element.url]
118
121
  );
119
- return /* @__PURE__ */ React.createElement("span", {
120
- ...attributes
121
- }, /* @__PURE__ */ React.createElement(Link, {
122
- href
123
- }, children));
122
+ return /* @__PURE__ */ jsxRuntime.jsx("span", {
123
+ ...attributes,
124
+ children: /* @__PURE__ */ jsxRuntime.jsx(Link, {
125
+ href,
126
+ children
127
+ })
128
+ });
124
129
  }
125
130
  function ComposerEditorMentionSuggestionsWrapper({
126
131
  id,
@@ -139,7 +144,7 @@ function ComposerEditorMentionSuggestionsWrapper({
139
144
  const { onEditorChange } = contexts.useComposerEditorContext();
140
145
  const { isFocused } = contexts.useComposer();
141
146
  const { portalContainer } = config.useLiveblocksUIConfig();
142
- const [contentRef, contentZIndex] = utils.useContentZIndex();
147
+ const [contentRef, contentZIndex] = utils$1.useContentZIndex();
143
148
  const isOpen = isFocused && mentionDraft?.range !== void 0 && userIds !== void 0;
144
149
  const {
145
150
  refs: { setReference, setFloating },
@@ -148,7 +153,7 @@ function ComposerEditorMentionSuggestionsWrapper({
148
153
  placement,
149
154
  x,
150
155
  y
151
- } = utils.useFloatingWithOptions({
156
+ } = utils$1.useFloatingWithOptions({
152
157
  position,
153
158
  dir,
154
159
  alignment: "start",
@@ -157,7 +162,7 @@ function ComposerEditorMentionSuggestionsWrapper({
157
162
  useObservable.useObservable(onEditorChange, () => {
158
163
  setMentionDraft(mentions.getMentionDraftAtSelection(editor));
159
164
  });
160
- useLayoutEffect.useLayoutEffect(() => {
165
+ react.useLayoutEffect(() => {
161
166
  if (!mentionDraft) {
162
167
  setReference(null);
163
168
  return;
@@ -165,32 +170,36 @@ function ComposerEditorMentionSuggestionsWrapper({
165
170
  const domRange = getDomRange.getDOMRange(editor, mentionDraft.range);
166
171
  setReference(domRange ?? null);
167
172
  }, [setReference, editor, mentionDraft]);
168
- return /* @__PURE__ */ React.createElement(Persist.Persist, null, isOpen ? /* @__PURE__ */ React.createElement(contexts.ComposerSuggestionsContext.Provider, {
169
- value: {
170
- id,
171
- itemId,
172
- selectedValue: selectedUserId,
173
- setSelectedValue: setSelectedUserId,
174
- onItemSelect,
175
- placement,
176
- dir,
177
- ref: contentRef
178
- }
179
- }, /* @__PURE__ */ React.createElement(Portal.Portal, {
180
- ref: setFloating,
181
- container: portalContainer,
182
- style: {
183
- position: strategy,
184
- top: 0,
185
- left: 0,
186
- transform: isPositioned ? `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)` : "translate3d(0, -200%, 0)",
187
- minWidth: "max-content",
188
- zIndex: contentZIndex
189
- }
190
- }, /* @__PURE__ */ React.createElement(MentionSuggestions, {
191
- userIds,
192
- selectedUserId
193
- }))) : null);
173
+ return /* @__PURE__ */ jsxRuntime.jsx(Persist.Persist, {
174
+ children: isOpen ? /* @__PURE__ */ jsxRuntime.jsx(contexts.ComposerSuggestionsContext.Provider, {
175
+ value: {
176
+ id,
177
+ itemId,
178
+ selectedValue: selectedUserId,
179
+ setSelectedValue: setSelectedUserId,
180
+ onItemSelect,
181
+ placement,
182
+ dir,
183
+ ref: contentRef
184
+ },
185
+ children: /* @__PURE__ */ jsxRuntime.jsx(Portal.Portal, {
186
+ ref: setFloating,
187
+ container: portalContainer,
188
+ style: {
189
+ position: strategy,
190
+ top: 0,
191
+ left: 0,
192
+ transform: isPositioned ? `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)` : "translate3d(0, -200%, 0)",
193
+ minWidth: "max-content",
194
+ zIndex: contentZIndex
195
+ },
196
+ children: /* @__PURE__ */ jsxRuntime.jsx(MentionSuggestions, {
197
+ userIds,
198
+ selectedUserId
199
+ })
200
+ })
201
+ }) : null
202
+ });
194
203
  }
195
204
  function ComposerEditorFloatingToolbarWrapper({
196
205
  id,
@@ -204,8 +213,8 @@ function ComposerEditorFloatingToolbarWrapper({
204
213
  const { onEditorChange } = contexts.useComposerEditorContext();
205
214
  const { isFocused } = contexts.useComposer();
206
215
  const { portalContainer } = config.useLiveblocksUIConfig();
207
- const [contentRef, contentZIndex] = utils.useContentZIndex();
208
- const [isPointerDown, setPointerDown] = React.useState(false);
216
+ const [contentRef, contentZIndex] = utils$1.useContentZIndex();
217
+ const [isPointerDown, setPointerDown] = react.useState(false);
209
218
  const isOpen = isFocused && !isPointerDown && hasFloatingToolbarRange;
210
219
  const {
211
220
  refs: { setReference, setFloating },
@@ -214,14 +223,14 @@ function ComposerEditorFloatingToolbarWrapper({
214
223
  placement,
215
224
  x,
216
225
  y
217
- } = utils.useFloatingWithOptions({
226
+ } = utils$1.useFloatingWithOptions({
218
227
  type: "range",
219
228
  position,
220
229
  dir,
221
230
  alignment: "center",
222
231
  open: isOpen
223
232
  });
224
- useLayoutEffect.useLayoutEffect(() => {
233
+ react.useLayoutEffect(() => {
225
234
  if (!isFocused) {
226
235
  return;
227
236
  }
@@ -248,29 +257,33 @@ function ComposerEditorFloatingToolbarWrapper({
248
257
  }
249
258
  });
250
259
  });
251
- return /* @__PURE__ */ React.createElement(Persist.Persist, null, isOpen ? /* @__PURE__ */ React.createElement(contexts.ComposerFloatingToolbarContext.Provider, {
252
- value: {
253
- id,
254
- placement,
255
- dir,
256
- ref: contentRef
257
- }
258
- }, /* @__PURE__ */ React.createElement(Portal.Portal, {
259
- ref: setFloating,
260
- container: portalContainer,
261
- style: {
262
- position: strategy,
263
- top: 0,
264
- left: 0,
265
- transform: isPositioned ? `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)` : "translate3d(0, -200%, 0)",
266
- minWidth: "max-content",
267
- zIndex: contentZIndex
268
- }
269
- }, /* @__PURE__ */ React.createElement(FloatingToolbar, null))) : null);
260
+ return /* @__PURE__ */ jsxRuntime.jsx(Persist.Persist, {
261
+ children: isOpen ? /* @__PURE__ */ jsxRuntime.jsx(contexts.ComposerFloatingToolbarContext.Provider, {
262
+ value: {
263
+ id,
264
+ placement,
265
+ dir,
266
+ ref: contentRef
267
+ },
268
+ children: /* @__PURE__ */ jsxRuntime.jsx(Portal.Portal, {
269
+ ref: setFloating,
270
+ container: portalContainer,
271
+ style: {
272
+ position: strategy,
273
+ top: 0,
274
+ left: 0,
275
+ transform: isPositioned ? `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)` : "translate3d(0, -200%, 0)",
276
+ minWidth: "max-content",
277
+ zIndex: contentZIndex
278
+ },
279
+ children: /* @__PURE__ */ jsxRuntime.jsx(FloatingToolbar, {})
280
+ })
281
+ }) : null
282
+ });
270
283
  }
271
- const ComposerFloatingToolbar = React.forwardRef(({ children, onPointerDown, style, asChild, ...props }, forwardedRef) => {
284
+ const ComposerFloatingToolbar = react.forwardRef(({ children, onPointerDown, style, asChild, ...props }, forwardedRef) => {
272
285
  const [isPresent] = Persist.usePersist();
273
- const ref = React.useRef(null);
286
+ const ref = react.useRef(null);
274
287
  const {
275
288
  id,
276
289
  ref: contentRef,
@@ -278,13 +291,13 @@ const ComposerFloatingToolbar = React.forwardRef(({ children, onPointerDown, sty
278
291
  dir
279
292
  } = contexts.useComposerFloatingToolbarContext(COMPOSER_FLOATING_TOOLBAR_NAME);
280
293
  const mergedRefs = useRefs.useRefs(forwardedRef, contentRef, ref);
281
- const [side, align] = React.useMemo(
282
- () => utils.getSideAndAlignFromFloatingPlacement(placement),
294
+ const [side, align] = react.useMemo(
295
+ () => utils$1.getSideAndAlignFromFloatingPlacement(placement),
283
296
  [placement]
284
297
  );
285
298
  const Component = asChild ? reactSlot.Slot : "div";
286
299
  Persist.useAnimationPersist(ref);
287
- const handlePointerDown = React.useCallback(
300
+ const handlePointerDown = react.useCallback(
288
301
  (event) => {
289
302
  onPointerDown?.(event);
290
303
  event.preventDefault();
@@ -292,7 +305,7 @@ const ComposerFloatingToolbar = React.forwardRef(({ children, onPointerDown, sty
292
305
  },
293
306
  [onPointerDown]
294
307
  );
295
- return /* @__PURE__ */ React.createElement(Component, {
308
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, {
296
309
  dir,
297
310
  role: "toolbar",
298
311
  id,
@@ -309,8 +322,9 @@ const ComposerFloatingToolbar = React.forwardRef(({ children, onPointerDown, sty
309
322
  overflowX: "auto",
310
323
  ...style
311
324
  },
312
- ref: mergedRefs
313
- }, children);
325
+ ref: mergedRefs,
326
+ children
327
+ });
314
328
  });
315
329
  function ComposerEditorElement({
316
330
  Mention,
@@ -320,91 +334,104 @@ function ComposerEditorElement({
320
334
  const { attributes, children, element } = props;
321
335
  switch (element.type) {
322
336
  case "mention":
323
- return /* @__PURE__ */ React.createElement(ComposerEditorMentionWrapper, {
337
+ return /* @__PURE__ */ jsxRuntime.jsx(ComposerEditorMentionWrapper, {
324
338
  Mention,
325
339
  ...props
326
340
  });
327
341
  case "auto-link":
328
342
  case "custom-link":
329
- return /* @__PURE__ */ React.createElement(ComposerEditorLinkWrapper, {
343
+ return /* @__PURE__ */ jsxRuntime.jsx(ComposerEditorLinkWrapper, {
330
344
  Link,
331
345
  ...props
332
346
  });
333
347
  case "paragraph":
334
- return /* @__PURE__ */ React.createElement("p", {
348
+ return /* @__PURE__ */ jsxRuntime.jsx("p", {
335
349
  ...attributes,
336
- style: { position: "relative" }
337
- }, children);
350
+ style: { position: "relative" },
351
+ children
352
+ });
338
353
  default:
339
354
  return null;
340
355
  }
341
356
  }
342
357
  function ComposerEditorLeaf({ attributes, children, leaf }) {
343
358
  if (leaf.bold) {
344
- children = /* @__PURE__ */ React.createElement("strong", null, children);
359
+ children = /* @__PURE__ */ jsxRuntime.jsx("strong", {
360
+ children
361
+ });
345
362
  }
346
363
  if (leaf.italic) {
347
- children = /* @__PURE__ */ React.createElement("em", null, children);
364
+ children = /* @__PURE__ */ jsxRuntime.jsx("em", {
365
+ children
366
+ });
348
367
  }
349
368
  if (leaf.strikethrough) {
350
- children = /* @__PURE__ */ React.createElement("s", null, children);
369
+ children = /* @__PURE__ */ jsxRuntime.jsx("s", {
370
+ children
371
+ });
351
372
  }
352
373
  if (leaf.code) {
353
- children = /* @__PURE__ */ React.createElement("code", null, children);
374
+ children = /* @__PURE__ */ jsxRuntime.jsx("code", {
375
+ children
376
+ });
354
377
  }
355
- return /* @__PURE__ */ React.createElement("span", {
356
- ...attributes
357
- }, children);
378
+ return /* @__PURE__ */ jsxRuntime.jsx("span", {
379
+ ...attributes,
380
+ children
381
+ });
358
382
  }
359
383
  function ComposerEditorPlaceholder({
360
384
  attributes,
361
385
  children
362
386
  }) {
363
387
  const { opacity: _opacity, ...style } = attributes.style;
364
- return /* @__PURE__ */ React.createElement("span", {
388
+ return /* @__PURE__ */ jsxRuntime.jsx("span", {
365
389
  ...attributes,
366
390
  style,
367
- "data-placeholder": ""
368
- }, children);
391
+ "data-placeholder": "",
392
+ children
393
+ });
369
394
  }
370
- const ComposerMention = React.forwardRef(
395
+ const ComposerMention = react.forwardRef(
371
396
  ({ children, asChild, ...props }, forwardedRef) => {
372
397
  const Component = asChild ? reactSlot.Slot : "span";
373
398
  const isSelected = slateReact.useSelected();
374
- return /* @__PURE__ */ React.createElement(Component, {
399
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, {
375
400
  "data-selected": isSelected || void 0,
376
401
  ...props,
377
- ref: forwardedRef
378
- }, children);
402
+ ref: forwardedRef,
403
+ children
404
+ });
379
405
  }
380
406
  );
381
- const ComposerLink = React.forwardRef(
407
+ const ComposerLink = react.forwardRef(
382
408
  ({ children, asChild, ...props }, forwardedRef) => {
383
409
  const Component = asChild ? reactSlot.Slot : "a";
384
- return /* @__PURE__ */ React.createElement(Component, {
410
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, {
385
411
  target: "_blank",
386
412
  rel: "noopener noreferrer nofollow",
387
413
  ...props,
388
- ref: forwardedRef
389
- }, children);
414
+ ref: forwardedRef,
415
+ children
416
+ });
390
417
  }
391
418
  );
392
- const ComposerSuggestions = React.forwardRef(({ children, style, asChild, ...props }, forwardedRef) => {
419
+ const ComposerSuggestions = react.forwardRef(({ children, style, asChild, ...props }, forwardedRef) => {
393
420
  const [isPresent] = Persist.usePersist();
394
- const ref = React.useRef(null);
421
+ const ref = react.useRef(null);
395
422
  const {
396
423
  ref: contentRef,
397
424
  placement,
398
425
  dir
399
426
  } = contexts.useComposerSuggestionsContext(COMPOSER_SUGGESTIONS_NAME);
400
427
  const mergedRefs = useRefs.useRefs(forwardedRef, contentRef, ref);
401
- const [side, align] = React.useMemo(
402
- () => utils.getSideAndAlignFromFloatingPlacement(placement),
428
+ const [side, align] = react.useMemo(
429
+ () => utils$1.getSideAndAlignFromFloatingPlacement(placement),
403
430
  [placement]
404
431
  );
405
432
  const Component = asChild ? reactSlot.Slot : "div";
406
433
  Persist.useAnimationPersist(ref);
407
- return /* @__PURE__ */ React.createElement(Component, {
434
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, {
408
435
  dir,
409
436
  ...props,
410
437
  "data-state": isPresent ? "open" : "closed",
@@ -417,21 +444,23 @@ const ComposerSuggestions = React.forwardRef(({ children, style, asChild, ...pro
417
444
  overflowY: "auto",
418
445
  ...style
419
446
  },
420
- ref: mergedRefs
421
- }, children);
447
+ ref: mergedRefs,
448
+ children
449
+ });
422
450
  });
423
- const ComposerSuggestionsList = React.forwardRef(({ children, asChild, ...props }, forwardedRef) => {
451
+ const ComposerSuggestionsList = react.forwardRef(({ children, asChild, ...props }, forwardedRef) => {
424
452
  const { id } = contexts.useComposerSuggestionsContext(COMPOSER_SUGGESTIONS_LIST_NAME);
425
453
  const Component = asChild ? reactSlot.Slot : "ul";
426
- return /* @__PURE__ */ React.createElement(Component, {
454
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, {
427
455
  role: "listbox",
428
456
  id,
429
457
  "aria-label": "Suggestions list",
430
458
  ...props,
431
- ref: forwardedRef
432
- }, children);
459
+ ref: forwardedRef,
460
+ children
461
+ });
433
462
  });
434
- const ComposerSuggestionsListItem = React.forwardRef(
463
+ const ComposerSuggestionsListItem = react.forwardRef(
435
464
  ({
436
465
  value,
437
466
  children,
@@ -441,21 +470,21 @@ const ComposerSuggestionsListItem = React.forwardRef(
441
470
  asChild,
442
471
  ...props
443
472
  }, forwardedRef) => {
444
- const ref = React.useRef(null);
473
+ const ref = react.useRef(null);
445
474
  const mergedRefs = useRefs.useRefs(forwardedRef, ref);
446
475
  const { selectedValue, setSelectedValue, itemId, onItemSelect } = contexts.useComposerSuggestionsContext(COMPOSER_SUGGESTIONS_LIST_ITEM_NAME);
447
476
  const Component = asChild ? reactSlot.Slot : "li";
448
- const isSelected = React.useMemo(
477
+ const isSelected = react.useMemo(
449
478
  () => selectedValue === value,
450
479
  [selectedValue, value]
451
480
  );
452
- const id = React.useMemo(() => itemId(value), [itemId, value]);
453
- React.useEffect(() => {
481
+ const id = react.useMemo(() => itemId(value), [itemId, value]);
482
+ react.useEffect(() => {
454
483
  if (ref?.current && isSelected) {
455
484
  ref.current.scrollIntoView({ block: "nearest" });
456
485
  }
457
486
  }, [isSelected]);
458
- const handlePointerMove = React.useCallback(
487
+ const handlePointerMove = react.useCallback(
459
488
  (event) => {
460
489
  onPointerMove?.(event);
461
490
  if (!event.isDefaultPrevented()) {
@@ -464,7 +493,7 @@ const ComposerSuggestionsListItem = React.forwardRef(
464
493
  },
465
494
  [onPointerMove, setSelectedValue, value]
466
495
  );
467
- const handlePointerDown = React.useCallback(
496
+ const handlePointerDown = react.useCallback(
468
497
  (event) => {
469
498
  onPointerDown?.(event);
470
499
  event.preventDefault();
@@ -472,7 +501,7 @@ const ComposerSuggestionsListItem = React.forwardRef(
472
501
  },
473
502
  [onPointerDown]
474
503
  );
475
- const handleClick = React.useCallback(
504
+ const handleClick = react.useCallback(
476
505
  (event) => {
477
506
  onClick?.(event);
478
507
  const wasDefaultPrevented = event.isDefaultPrevented();
@@ -484,7 +513,7 @@ const ComposerSuggestionsListItem = React.forwardRef(
484
513
  },
485
514
  [onClick, onItemSelect, value]
486
515
  );
487
- return /* @__PURE__ */ React.createElement(Component, {
516
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, {
488
517
  role: "option",
489
518
  id,
490
519
  "data-selected": isSelected || void 0,
@@ -493,27 +522,38 @@ const ComposerSuggestionsListItem = React.forwardRef(
493
522
  onPointerDown: handlePointerDown,
494
523
  onClick: handleClick,
495
524
  ...props,
496
- ref: mergedRefs
497
- }, children);
525
+ ref: mergedRefs,
526
+ children
527
+ });
498
528
  }
499
529
  );
500
530
  const defaultEditorComponents = {
501
531
  Link: ({ href, children }) => {
502
- return /* @__PURE__ */ React.createElement(ComposerLink, {
503
- href
504
- }, children);
532
+ return /* @__PURE__ */ jsxRuntime.jsx(ComposerLink, {
533
+ href,
534
+ children
535
+ });
505
536
  },
506
537
  Mention: ({ userId }) => {
507
- return /* @__PURE__ */ React.createElement(ComposerMention, null, mentions.MENTION_CHARACTER, userId);
538
+ return /* @__PURE__ */ jsxRuntime.jsxs(ComposerMention, {
539
+ children: [
540
+ mentions.MENTION_CHARACTER,
541
+ userId
542
+ ]
543
+ });
508
544
  },
509
545
  MentionSuggestions: ({ userIds }) => {
510
- return userIds.length > 0 ? /* @__PURE__ */ React.createElement(ComposerSuggestions, null, /* @__PURE__ */ React.createElement(ComposerSuggestionsList, null, userIds.map((userId) => /* @__PURE__ */ React.createElement(ComposerSuggestionsListItem, {
511
- key: userId,
512
- value: userId
513
- }, userId)))) : null;
546
+ return userIds.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(ComposerSuggestions, {
547
+ children: /* @__PURE__ */ jsxRuntime.jsx(ComposerSuggestionsList, {
548
+ children: userIds.map((userId) => /* @__PURE__ */ jsxRuntime.jsx(ComposerSuggestionsListItem, {
549
+ value: userId,
550
+ children: userId
551
+ }, userId))
552
+ })
553
+ }) : null;
514
554
  }
515
555
  };
516
- const ComposerEditor = React.forwardRef(
556
+ const ComposerEditor = react.forwardRef(
517
557
  ({
518
558
  defaultValue,
519
559
  onKeyDown,
@@ -538,16 +578,17 @@ const ComposerEditor = React.forwardRef(
538
578
  } = contexts.useComposer();
539
579
  const isDisabled = isComposerDisabled || disabled;
540
580
  const initialBody = useInitial.useInitial(defaultValue ?? emptyCommentBody);
541
- const initialEditorValue = React.useMemo(() => {
542
- return utils.commentBodyToComposerBody(initialBody);
581
+ const initialEditorValue = react.useMemo(() => {
582
+ return utils$1.commentBodyToComposerBody(initialBody);
543
583
  }, [initialBody]);
544
- const { Link, Mention, MentionSuggestions, FloatingToolbar } = React.useMemo(
584
+ const { Link, Mention, MentionSuggestions, FloatingToolbar } = react.useMemo(
545
585
  () => ({ ...defaultEditorComponents, ...components }),
546
586
  [components]
547
587
  );
548
- const [hasFloatingToolbarRange, setHasFloatingToolbarRange] = React.useState(false);
549
- const hasResolveMentionSuggestions = client ? client[core.kInternal].resolveMentionSuggestions !== void 0 : true;
550
- const [mentionDraft, setMentionDraft] = React.useState();
588
+ const [hasFloatingToolbarRange, setHasFloatingToolbarRange] = react.useState(false);
589
+ const resolveMentionSuggestions = _private.useResolveMentionSuggestions();
590
+ const hasResolveMentionSuggestions = client ? resolveMentionSuggestions : true;
591
+ const [mentionDraft, setMentionDraft] = react.useState();
551
592
  const mentionSuggestions = _private.useMentionSuggestions(
552
593
  roomId,
553
594
  mentionDraft?.text
@@ -558,22 +599,22 @@ const ComposerEditor = React.forwardRef(
558
599
  setNextSelectedMentionSuggestionIndex,
559
600
  setSelectedMentionSuggestionIndex
560
601
  ] = useIndex.useIndex(0, mentionSuggestions?.length ?? 0);
561
- const id = useId.useId();
562
- const floatingToolbarId = React.useMemo(
602
+ const id = react.useId();
603
+ const floatingToolbarId = react.useMemo(
563
604
  () => `liveblocks-floating-toolbar-${id}`,
564
605
  [id]
565
606
  );
566
- const suggestionsListId = React.useMemo(
607
+ const suggestionsListId = react.useMemo(
567
608
  () => `liveblocks-suggestions-list-${id}`,
568
609
  [id]
569
610
  );
570
- const suggestionsListItemId = React.useCallback(
611
+ const suggestionsListItemId = react.useCallback(
571
612
  (userId) => userId ? `liveblocks-suggestions-list-item-${id}-${userId}` : void 0,
572
613
  [id]
573
614
  );
574
- const renderElement = React.useCallback(
615
+ const renderElement = react.useCallback(
575
616
  (props2) => {
576
- return /* @__PURE__ */ React.createElement(ComposerEditorElement, {
617
+ return /* @__PURE__ */ jsxRuntime.jsx(ComposerEditorElement, {
577
618
  Mention,
578
619
  Link,
579
620
  ...props2
@@ -581,14 +622,14 @@ const ComposerEditor = React.forwardRef(
581
622
  },
582
623
  [Link, Mention]
583
624
  );
584
- const handleChange = React.useCallback(
625
+ const handleChange = react.useCallback(
585
626
  (value) => {
586
627
  validate(value);
587
628
  onEditorChange.notify();
588
629
  },
589
630
  [validate, onEditorChange]
590
631
  );
591
- const createMention = React.useCallback(
632
+ const createMention = react.useCallback(
592
633
  (userId) => {
593
634
  if (!mentionDraft || !userId) {
594
635
  return;
@@ -600,7 +641,7 @@ const ComposerEditor = React.forwardRef(
600
641
  },
601
642
  [editor, mentionDraft, setSelectedMentionSuggestionIndex]
602
643
  );
603
- const handleKeyDown = React.useCallback(
644
+ const handleKeyDown = react.useCallback(
604
645
  (event) => {
605
646
  onKeyDown?.(event);
606
647
  if (event.isDefaultPrevented()) {
@@ -686,7 +727,7 @@ const ComposerEditor = React.forwardRef(
686
727
  submit
687
728
  ]
688
729
  );
689
- const handleFocus = React.useCallback(
730
+ const handleFocus = react.useCallback(
690
731
  (event) => {
691
732
  onFocus?.(event);
692
733
  if (!event.isDefaultPrevented()) {
@@ -695,7 +736,7 @@ const ComposerEditor = React.forwardRef(
695
736
  },
696
737
  [onFocus, setFocused]
697
738
  );
698
- const handleBlur = React.useCallback(
739
+ const handleBlur = react.useCallback(
699
740
  (event) => {
700
741
  onBlur?.(event);
701
742
  if (!event.isDefaultPrevented()) {
@@ -704,11 +745,11 @@ const ComposerEditor = React.forwardRef(
704
745
  },
705
746
  [onBlur, setFocused]
706
747
  );
707
- const selectedMentionSuggestionUserId = React.useMemo(
748
+ const selectedMentionSuggestionUserId = react.useMemo(
708
749
  () => mentionSuggestions?.[selectedMentionSuggestionIndex],
709
750
  [selectedMentionSuggestionIndex, mentionSuggestions]
710
751
  );
711
- const setSelectedMentionSuggestionUserId = React.useCallback(
752
+ const setSelectedMentionSuggestionUserId = react.useCallback(
712
753
  (userId) => {
713
754
  const index = mentionSuggestions?.indexOf(userId);
714
755
  if (index !== void 0 && index >= 0) {
@@ -717,7 +758,7 @@ const ComposerEditor = React.forwardRef(
717
758
  },
718
759
  [setSelectedMentionSuggestionIndex, mentionSuggestions]
719
760
  );
720
- const additionalProps = React.useMemo(
761
+ const additionalProps = react.useMemo(
721
762
  () => mentionDraft ? {
722
763
  role: "combobox",
723
764
  "aria-autocomplete": "list",
@@ -739,58 +780,63 @@ const ComposerEditor = React.forwardRef(
739
780
  floatingToolbarId
740
781
  ]
741
782
  );
742
- React.useImperativeHandle(forwardedRef, () => {
783
+ react.useImperativeHandle(forwardedRef, () => {
743
784
  return slateReact.ReactEditor.toDOMNode(editor, editor);
744
785
  }, [editor]);
745
- useLayoutEffect.useLayoutEffect(() => {
786
+ react.useLayoutEffect(() => {
746
787
  if (autoFocus) {
747
788
  focus();
748
789
  }
749
790
  }, [autoFocus, editor, focus]);
750
- useLayoutEffect.useLayoutEffect(() => {
791
+ react.useLayoutEffect(() => {
751
792
  if (isFocused && editor.selection === null) {
752
793
  select();
753
794
  }
754
795
  }, [editor, select, isFocused]);
755
- return /* @__PURE__ */ React.createElement(slateReact.Slate, {
796
+ return /* @__PURE__ */ jsxRuntime.jsxs(slateReact.Slate, {
756
797
  editor,
757
798
  initialValue: initialEditorValue,
758
- onChange: handleChange
759
- }, /* @__PURE__ */ React.createElement(slateReact.Editable, {
760
- dir,
761
- enterKeyHint: mentionDraft ? "enter" : "send",
762
- autoCapitalize: "sentences",
763
- "aria-label": "Composer editor",
764
- "data-focused": isFocused || void 0,
765
- "data-disabled": isDisabled || void 0,
766
- ...additionalProps,
767
- ...props,
768
- readOnly: isDisabled,
769
- disabled: isDisabled,
770
- onKeyDown: handleKeyDown,
771
- onFocus: handleFocus,
772
- onBlur: handleBlur,
773
- renderElement,
774
- renderLeaf: ComposerEditorLeaf,
775
- renderPlaceholder: ComposerEditorPlaceholder
776
- }), hasResolveMentionSuggestions && /* @__PURE__ */ React.createElement(ComposerEditorMentionSuggestionsWrapper, {
777
- dir,
778
- mentionDraft,
779
- setMentionDraft,
780
- selectedUserId: selectedMentionSuggestionUserId,
781
- setSelectedUserId: setSelectedMentionSuggestionUserId,
782
- userIds: mentionSuggestions,
783
- id: suggestionsListId,
784
- itemId: suggestionsListItemId,
785
- onItemSelect: createMention,
786
- MentionSuggestions
787
- }), FloatingToolbar && /* @__PURE__ */ React.createElement(ComposerEditorFloatingToolbarWrapper, {
788
- dir,
789
- id: floatingToolbarId,
790
- hasFloatingToolbarRange,
791
- setHasFloatingToolbarRange,
792
- FloatingToolbar
793
- }));
799
+ onChange: handleChange,
800
+ children: [
801
+ /* @__PURE__ */ jsxRuntime.jsx(slateReact.Editable, {
802
+ dir,
803
+ enterKeyHint: mentionDraft ? "enter" : "send",
804
+ autoCapitalize: "sentences",
805
+ "aria-label": "Composer editor",
806
+ "data-focused": isFocused || void 0,
807
+ "data-disabled": isDisabled || void 0,
808
+ ...additionalProps,
809
+ ...props,
810
+ readOnly: isDisabled,
811
+ disabled: isDisabled,
812
+ onKeyDown: handleKeyDown,
813
+ onFocus: handleFocus,
814
+ onBlur: handleBlur,
815
+ renderElement,
816
+ renderLeaf: ComposerEditorLeaf,
817
+ renderPlaceholder: ComposerEditorPlaceholder
818
+ }),
819
+ hasResolveMentionSuggestions && /* @__PURE__ */ jsxRuntime.jsx(ComposerEditorMentionSuggestionsWrapper, {
820
+ dir,
821
+ mentionDraft,
822
+ setMentionDraft,
823
+ selectedUserId: selectedMentionSuggestionUserId,
824
+ setSelectedUserId: setSelectedMentionSuggestionUserId,
825
+ userIds: mentionSuggestions,
826
+ id: suggestionsListId,
827
+ itemId: suggestionsListItemId,
828
+ onItemSelect: createMention,
829
+ MentionSuggestions
830
+ }),
831
+ FloatingToolbar && /* @__PURE__ */ jsxRuntime.jsx(ComposerEditorFloatingToolbarWrapper, {
832
+ dir,
833
+ id: floatingToolbarId,
834
+ hasFloatingToolbarRange,
835
+ setHasFloatingToolbarRange,
836
+ FloatingToolbar
837
+ })
838
+ ]
839
+ });
794
840
  }
795
841
  );
796
842
  const MAX_ATTACHMENTS = 10;
@@ -806,7 +852,7 @@ function prepareAttachment(file) {
806
852
  file
807
853
  };
808
854
  }
809
- const ComposerForm = React.forwardRef(
855
+ const ComposerForm = react.forwardRef(
810
856
  ({
811
857
  children,
812
858
  onSubmit,
@@ -820,9 +866,9 @@ const ComposerForm = React.forwardRef(
820
866
  ...props
821
867
  }, forwardedRef) => {
822
868
  const Component = asChild ? reactSlot.Slot : "form";
823
- const [isEmpty$1, setEmpty] = React.useState(true);
824
- const [isSubmitting, setSubmitting] = React.useState(false);
825
- const [isFocused, setFocused] = React.useState(false);
869
+ const [isEmpty$1, setEmpty] = react.useState(true);
870
+ const [isSubmitting, setSubmitting] = react.useState(false);
871
+ const [isFocused, setFocused] = react.useState(false);
826
872
  const room = _private.useRoomOrNull();
827
873
  const roomId = _roomId !== void 0 ? _roomId : room?.id;
828
874
  if (roomId === void 0) {
@@ -836,30 +882,30 @@ const ComposerForm = React.forwardRef(
836
882
  addAttachments,
837
883
  removeAttachment,
838
884
  clearAttachments
839
- } = utils.useComposerAttachmentsManager(defaultAttachments, {
885
+ } = utils$1.useComposerAttachmentsManager(defaultAttachments, {
840
886
  maxFileSize: maxAttachmentSize,
841
887
  roomId
842
888
  });
843
889
  const numberOfAttachments = attachments.length;
844
890
  const hasMaxAttachments = numberOfAttachments >= maxAttachments;
845
- const isDisabled = React.useMemo(() => {
891
+ const isDisabled = react.useMemo(() => {
846
892
  return isSubmitting || disabled === true;
847
893
  }, [isSubmitting, disabled]);
848
- const canSubmit = React.useMemo(() => {
894
+ const canSubmit = react.useMemo(() => {
849
895
  return !isEmpty$1 && !isUploadingAttachments;
850
896
  }, [isEmpty$1, isUploadingAttachments]);
851
- const [marks$1, setMarks] = React.useState(marks.getMarks);
852
- const ref = React.useRef(null);
897
+ const [marks$1, setMarks] = react.useState(marks.getMarks);
898
+ const ref = react.useRef(null);
853
899
  const mergedRefs = useRefs.useRefs(forwardedRef, ref);
854
- const fileInputRef = React.useRef(null);
900
+ const fileInputRef = react.useRef(null);
855
901
  const syncSource = _private.useSyncSource();
856
902
  const isPending = !preventUnsavedChanges ? false : !isEmpty$1 || isUploadingAttachments || attachments.length > 0;
857
- React.useEffect(() => {
903
+ react.useEffect(() => {
858
904
  syncSource?.setSyncStatus(
859
905
  isPending ? "has-local-changes" : "synchronized"
860
906
  );
861
907
  }, [syncSource, isPending]);
862
- const createAttachments = React.useCallback(
908
+ const createAttachments = react.useCallback(
863
909
  (files) => {
864
910
  if (!files.length) {
865
911
  return;
@@ -874,11 +920,11 @@ const ComposerForm = React.forwardRef(
874
920
  },
875
921
  [addAttachments, maxAttachments, numberOfAttachments]
876
922
  );
877
- const createAttachmentsRef = React.useRef(createAttachments);
878
- React.useEffect(() => {
923
+ const createAttachmentsRef = react.useRef(createAttachments);
924
+ react.useEffect(() => {
879
925
  createAttachmentsRef.current = createAttachments;
880
926
  }, [createAttachments]);
881
- const stableCreateAttachments = React.useCallback((files) => {
927
+ const stableCreateAttachments = react.useCallback((files) => {
882
928
  createAttachmentsRef.current(files);
883
929
  }, []);
884
930
  const editor = useInitial.useInitial(
@@ -888,13 +934,13 @@ const ComposerForm = React.forwardRef(
888
934
  })
889
935
  );
890
936
  const onEditorChange = useInitial.useInitial(core.makeEventSource);
891
- const validate = React.useCallback(
937
+ const validate = react.useCallback(
892
938
  (value) => {
893
939
  setEmpty(isEmpty.isEmpty(editor, value));
894
940
  },
895
941
  [editor]
896
942
  );
897
- const submit = React.useCallback(() => {
943
+ const submit = react.useCallback(() => {
898
944
  if (!canSubmit) {
899
945
  return;
900
946
  }
@@ -904,7 +950,7 @@ const ComposerForm = React.forwardRef(
904
950
  }
905
951
  });
906
952
  }, [canSubmit]);
907
- const clear = React.useCallback(() => {
953
+ const clear = react.useCallback(() => {
908
954
  slate.Transforms.delete(editor, {
909
955
  at: {
910
956
  anchor: slate.Editor.start(editor, []),
@@ -912,10 +958,10 @@ const ComposerForm = React.forwardRef(
912
958
  }
913
959
  });
914
960
  }, [editor]);
915
- const select = React.useCallback(() => {
961
+ const select = react.useCallback(() => {
916
962
  slate.Transforms.select(editor, slate.Editor.end(editor, []));
917
963
  }, [editor]);
918
- const focus = React.useCallback(
964
+ const focus = react.useCallback(
919
965
  (resetSelection = true) => {
920
966
  if (!slateReact.ReactEditor.isFocused(editor)) {
921
967
  slate.Transforms.select(
@@ -927,17 +973,17 @@ const ComposerForm = React.forwardRef(
927
973
  },
928
974
  [editor]
929
975
  );
930
- const blur = React.useCallback(() => {
976
+ const blur = react.useCallback(() => {
931
977
  slateReact.ReactEditor.blur(editor);
932
978
  }, [editor]);
933
- const createMention = React.useCallback(() => {
979
+ const createMention = react.useCallback(() => {
934
980
  if (disabled) {
935
981
  return;
936
982
  }
937
983
  focus();
938
984
  mentions.insertMentionCharacter(editor);
939
985
  }, [disabled, editor, focus]);
940
- const insertText = React.useCallback(
986
+ const insertText = react.useCallback(
941
987
  (text) => {
942
988
  if (disabled) {
943
989
  return;
@@ -947,7 +993,7 @@ const ComposerForm = React.forwardRef(
947
993
  },
948
994
  [disabled, editor, focus]
949
995
  );
950
- const attachFiles = React.useCallback(() => {
996
+ const attachFiles = react.useCallback(() => {
951
997
  if (disabled) {
952
998
  return;
953
999
  }
@@ -955,7 +1001,7 @@ const ComposerForm = React.forwardRef(
955
1001
  fileInputRef.current.click();
956
1002
  }
957
1003
  }, [disabled]);
958
- const handleAttachmentsInputChange = React.useCallback(
1004
+ const handleAttachmentsInputChange = react.useCallback(
959
1005
  (event) => {
960
1006
  if (disabled) {
961
1007
  return;
@@ -967,13 +1013,13 @@ const ComposerForm = React.forwardRef(
967
1013
  },
968
1014
  [createAttachments, disabled]
969
1015
  );
970
- const onSubmitEnd = React.useCallback(() => {
1016
+ const onSubmitEnd = react.useCallback(() => {
971
1017
  clear();
972
1018
  blur();
973
1019
  clearAttachments();
974
1020
  setSubmitting(false);
975
1021
  }, [blur, clear, clearAttachments]);
976
- const handleSubmit = React.useCallback(
1022
+ const handleSubmit = react.useCallback(
977
1023
  (event) => {
978
1024
  if (disabled) {
979
1025
  return;
@@ -988,7 +1034,7 @@ const ComposerForm = React.forwardRef(
988
1034
  event.preventDefault();
989
1035
  return;
990
1036
  }
991
- const body = utils.composerBodyToCommentBody(
1037
+ const body = utils$1.composerBodyToCommentBody(
992
1038
  editor.children
993
1039
  );
994
1040
  const commentAttachments = attachments.filter(
@@ -1016,10 +1062,10 @@ const ComposerForm = React.forwardRef(
1016
1062
  },
1017
1063
  [disabled, editor, attachments, onComposerSubmit, onSubmit, onSubmitEnd]
1018
1064
  );
1019
- const stopPropagation = React.useCallback((event) => {
1065
+ const stopPropagation = react.useCallback((event) => {
1020
1066
  event.stopPropagation();
1021
1067
  }, []);
1022
- const toggleMark = React.useCallback(
1068
+ const toggleMark = react.useCallback(
1023
1069
  (mark) => {
1024
1070
  marks.toggleMark(editor, mark);
1025
1071
  },
@@ -1028,75 +1074,85 @@ const ComposerForm = React.forwardRef(
1028
1074
  useObservable.useObservable(onEditorChange, () => {
1029
1075
  setMarks(marks.getMarks(editor));
1030
1076
  });
1031
- return /* @__PURE__ */ React.createElement(contexts.ComposerEditorContext.Provider, {
1077
+ return /* @__PURE__ */ jsxRuntime.jsx(contexts.ComposerEditorContext.Provider, {
1032
1078
  value: {
1033
1079
  editor,
1034
1080
  validate,
1035
1081
  setFocused,
1036
1082
  onEditorChange,
1037
1083
  roomId
1038
- }
1039
- }, /* @__PURE__ */ React.createElement(contexts.ComposerAttachmentsContext.Provider, {
1040
- value: {
1041
- createAttachments,
1042
- isUploadingAttachments,
1043
- hasMaxAttachments,
1044
- maxAttachments,
1045
- maxAttachmentSize
1046
- }
1047
- }, /* @__PURE__ */ React.createElement(contexts.ComposerContext.Provider, {
1048
- value: {
1049
- isDisabled,
1050
- isFocused,
1051
- isEmpty: isEmpty$1,
1052
- canSubmit,
1053
- submit,
1054
- clear,
1055
- select,
1056
- focus,
1057
- blur,
1058
- createMention,
1059
- insertText,
1060
- attachments,
1061
- attachFiles,
1062
- removeAttachment,
1063
- toggleMark,
1064
- marks: marks$1
1065
- }
1066
- }, /* @__PURE__ */ React.createElement(Component, {
1067
- ...props,
1068
- onSubmit: handleSubmit,
1069
- ref: mergedRefs
1070
- }, /* @__PURE__ */ React.createElement("input", {
1071
- type: "file",
1072
- multiple: true,
1073
- ref: fileInputRef,
1074
- onChange: handleAttachmentsInputChange,
1075
- onClick: stopPropagation,
1076
- tabIndex: -1,
1077
- style: { display: "none" }
1078
- }), /* @__PURE__ */ React.createElement(reactSlot.Slottable, null, children)))));
1084
+ },
1085
+ children: /* @__PURE__ */ jsxRuntime.jsx(contexts.ComposerAttachmentsContext.Provider, {
1086
+ value: {
1087
+ createAttachments,
1088
+ isUploadingAttachments,
1089
+ hasMaxAttachments,
1090
+ maxAttachments,
1091
+ maxAttachmentSize
1092
+ },
1093
+ children: /* @__PURE__ */ jsxRuntime.jsx(contexts.ComposerContext.Provider, {
1094
+ value: {
1095
+ isDisabled,
1096
+ isFocused,
1097
+ isEmpty: isEmpty$1,
1098
+ canSubmit,
1099
+ submit,
1100
+ clear,
1101
+ select,
1102
+ focus,
1103
+ blur,
1104
+ createMention,
1105
+ insertText,
1106
+ attachments,
1107
+ attachFiles,
1108
+ removeAttachment,
1109
+ toggleMark,
1110
+ marks: marks$1
1111
+ },
1112
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Component, {
1113
+ ...props,
1114
+ onSubmit: handleSubmit,
1115
+ ref: mergedRefs,
1116
+ children: [
1117
+ /* @__PURE__ */ jsxRuntime.jsx("input", {
1118
+ type: "file",
1119
+ multiple: true,
1120
+ ref: fileInputRef,
1121
+ onChange: handleAttachmentsInputChange,
1122
+ onClick: stopPropagation,
1123
+ tabIndex: -1,
1124
+ style: { display: "none" }
1125
+ }),
1126
+ /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slottable, {
1127
+ children
1128
+ })
1129
+ ]
1130
+ })
1131
+ })
1132
+ })
1133
+ });
1079
1134
  }
1080
1135
  );
1081
- const ComposerSubmit = React.forwardRef(
1136
+ const ComposerSubmit = react.forwardRef(
1082
1137
  ({ children, disabled, asChild, ...props }, forwardedRef) => {
1083
1138
  const Component = asChild ? reactSlot.Slot : "button";
1084
1139
  const { canSubmit, isDisabled: isComposerDisabled } = contexts.useComposer();
1085
1140
  const isDisabled = isComposerDisabled || disabled || !canSubmit;
1086
- return /* @__PURE__ */ React.createElement(Component, {
1141
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, {
1087
1142
  type: "submit",
1088
1143
  ...props,
1089
1144
  ref: forwardedRef,
1090
- disabled: isDisabled
1091
- }, children);
1145
+ disabled: isDisabled,
1146
+ children
1147
+ });
1092
1148
  }
1093
1149
  );
1094
- const ComposerAttachFiles = React.forwardRef(({ children, onClick, disabled, asChild, ...props }, forwardedRef) => {
1150
+ const ComposerAttachFiles = react.forwardRef(({ children, onClick, disabled, asChild, ...props }, forwardedRef) => {
1095
1151
  const Component = asChild ? reactSlot.Slot : "button";
1096
1152
  const { hasMaxAttachments } = contexts.useComposerAttachmentsContext();
1097
1153
  const { isDisabled: isComposerDisabled, attachFiles } = contexts.useComposer();
1098
1154
  const isDisabled = isComposerDisabled || hasMaxAttachments || disabled;
1099
- const handleClick = React.useCallback(
1155
+ const handleClick = react.useCallback(
1100
1156
  (event) => {
1101
1157
  onClick?.(event);
1102
1158
  if (!event.isDefaultPrevented()) {
@@ -1105,15 +1161,16 @@ const ComposerAttachFiles = React.forwardRef(({ children, onClick, disabled, asC
1105
1161
  },
1106
1162
  [attachFiles, onClick]
1107
1163
  );
1108
- return /* @__PURE__ */ React.createElement(Component, {
1164
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, {
1109
1165
  type: "button",
1110
1166
  ...props,
1111
1167
  onClick: handleClick,
1112
1168
  ref: forwardedRef,
1113
- disabled: isDisabled
1114
- }, children);
1169
+ disabled: isDisabled,
1170
+ children
1171
+ });
1115
1172
  });
1116
- const ComposerAttachmentsDropArea = React.forwardRef(
1173
+ const ComposerAttachmentsDropArea = react.forwardRef(
1117
1174
  ({
1118
1175
  onDragEnter,
1119
1176
  onDragLeave,
@@ -1126,14 +1183,14 @@ const ComposerAttachmentsDropArea = React.forwardRef(
1126
1183
  const Component = asChild ? reactSlot.Slot : "div";
1127
1184
  const { isDisabled: isComposerDisabled } = contexts.useComposer();
1128
1185
  const isDisabled = isComposerDisabled || disabled;
1129
- const [, dropAreaProps] = utils.useComposerAttachmentsDropArea({
1186
+ const [, dropAreaProps] = utils$1.useComposerAttachmentsDropArea({
1130
1187
  onDragEnter,
1131
1188
  onDragLeave,
1132
1189
  onDragOver,
1133
1190
  onDrop,
1134
1191
  disabled: isDisabled
1135
1192
  });
1136
- return /* @__PURE__ */ React.createElement(Component, {
1193
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, {
1137
1194
  ...dropAreaProps,
1138
1195
  "data-disabled": isDisabled ? "" : void 0,
1139
1196
  ...props,
@@ -1141,11 +1198,11 @@ const ComposerAttachmentsDropArea = React.forwardRef(
1141
1198
  });
1142
1199
  }
1143
1200
  );
1144
- const ComposerMarkToggle = React.forwardRef(
1201
+ const ComposerMarkToggle = react.forwardRef(
1145
1202
  ({ children, mark, onValueChange, onClick, asChild, ...props }, forwardedRef) => {
1146
1203
  const Component = asChild ? reactSlot.Slot : "button";
1147
1204
  const { marks, toggleMark } = contexts.useComposer();
1148
- const handleClick = React.useCallback(
1205
+ const handleClick = react.useCallback(
1149
1206
  (event) => {
1150
1207
  onClick?.(event);
1151
1208
  if (!event.isDefaultPrevented()) {
@@ -1155,15 +1212,17 @@ const ComposerMarkToggle = React.forwardRef(
1155
1212
  },
1156
1213
  [mark, onClick, onValueChange, toggleMark]
1157
1214
  );
1158
- return /* @__PURE__ */ React.createElement(TogglePrimitive__namespace.Root, {
1215
+ return /* @__PURE__ */ jsxRuntime.jsx(TogglePrimitive__namespace.Root, {
1159
1216
  asChild: true,
1160
1217
  pressed: marks[mark],
1161
1218
  onClick: handleClick,
1162
- ...props
1163
- }, /* @__PURE__ */ React.createElement(Component, {
1164
1219
  ...props,
1165
- ref: forwardedRef
1166
- }, children));
1220
+ children: /* @__PURE__ */ jsxRuntime.jsx(Component, {
1221
+ ...props,
1222
+ ref: forwardedRef,
1223
+ children
1224
+ })
1225
+ });
1167
1226
  }
1168
1227
  );
1169
1228
  if (process.env.NODE_ENV !== "production") {